Skip to content

DHTMLX/json2excel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON to Excell

npm version

How to build

yarn install // build js code yarn build // rebuild wasm code // rust toolchain is required yarn build-wasm 

CDN links

How to use

// worker.js import "json2excel-wasm";
// app.js const worker = new Worker("worker.js"); function doConvert(){ worker.postMessage({ type: "convert", data: json_data_to_export }); } worker.addEventListener("message", e => { if (e.data.type === "ready"){ const blob = e.data.blob; //excel file is ready to be downloaded! const a = document.createElement("a"); a.href = URL.createObjectURL(blob); a.download = "data.xlsx"; document.body.append(a); a.click(); document.body.remove(a); } });

License

MIT

Input format

interface IConvertMessageData { uid?: string; data: ISheetData; styles?: IStyles[]; wasmPath?: string; // use cdn by default } interface IReadyMessageData { uid: string; // same as incoming uid blob: Blob; } interface ISheetData { name?: string; cols?: IColumnData[]; rows?: IRowData[]; cells?: IDataCell[][]; // if cells mising, use plain plain?: string[][]; merged?: IMergedCells; } interface IMergedCells { from: IDataPoint; to: IDataPoint; } interface IDataPoint { column: number; row: number; } interface IColumnData { width: number; } interface IRowData { height: number; } interface IDataCell{ v: string; s: number; } interface IStyle { fontSize?: string; fontFamily?: string; borderLeft?: string; borderTop?: string; borderBottom?: string; borderRight?: string; format?: string; }

About

Generate excel file from json data

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6