{"id":20084519,"url":"https://github.com/dhtmlx/json2excel","last_synced_at":"2025-04-05T13:07:15.255Z","repository":{"id":57285521,"uuid":"170673157","full_name":"DHTMLX/json2excel","owner":"DHTMLX","description":"Generate excel file from json data","archived":false,"fork":false,"pushed_at":"2025-02-13T19:41:58.000Z","size":427,"stargazers_count":62,"open_issues_count":1,"forks_count":12,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-29T12:03:32.772Z","etag":null,"topics":["excel","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://dhtmlx.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DHTMLX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-14T10:28:21.000Z","updated_at":"2025-02-13T19:42:02.000Z","dependencies_parsed_at":"2024-06-21T07:28:14.312Z","dependency_job_id":"5299a999-3421-4305-bd17-1bbeabcadaa7","html_url":"https://github.com/DHTMLX/json2excel","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fjson2excel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fjson2excel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fjson2excel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fjson2excel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DHTMLX","download_url":"https://codeload.github.com/DHTMLX/json2excel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["excel","wasm","webassembly"],"created_at":"2024-11-13T15:52:18.280Z","updated_at":"2025-04-05T13:07:15.226Z","avatar_url":"https://github.com/DHTMLX.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"JSON2Excel \n--------------\n\nJSON2Excel is a Rust and WebAssembly-based library that allows converting JSON files into Excel ones at ease.\n\n[![npm version](https://badge.fury.io/js/json2excel-wasm.svg)](https://badge.fury.io/js/json2excel-wasm) \n\n### How to build\n\n```\n\ncargo install wasm-pack\nwasm-pack build\n```\n\n### How to use via npm\n\n- install the module\n\n```js\nyarn add json2excel-wasm\n```\n- import and use the module\n\n```js\n// worker.js\nimport { convert } \"json2excel-wasm\";\nconst blob = await convert(json_data_to_export);\n```\n\nyou can use code like next to force download of the result blob\n\n```js\nconst a = document.createElement(\"a\");\na.href = URL.createObjectURL(blob);\na.download = \"data.xlsx\";\ndocument.body.append(a);\na.click();\ndocument.body.remove(a);\n```\n\n### How to use from CDN\n\nCDN links are the following:\n\n- https://cdn.dhtmlx.com/libs/json2excel/1.3/worker.js \n- https://cdn.dhtmlx.com/libs/json2excel/1.3/module.js \n\nYou can import and use lib dynamically like \n\n```js\nconst convert = import(\"https://cdn.dhtmlx.com/libs/json2excel/1.3/module.js\");\nconst blob = await convert(json_data_to_export);\n```\n\nor use it as web worker\n\n```js\n// you need to server worker from the same domain as the main script\nvar worker = new Worker(\"./worker.js\"); \nworker.addEventListener(\"message\", ev =\u003e {\n    if (ev.data.type === \"ready\"){\n        const blob = ev.data.blob;\n        // do something with result\n    }\n});\nworker.postMessage({\n    type:\"convert\",\n    data: raw_json_data\n});\n```\n\nif you want to load worker script from CDN and not from your domain it requires a more complicated approach, as you need to catch the moment when service inside of the worker will be fully initialized\n\n```js\nvar url = window.URL.createObjectURL(new Blob([\n    \"importScripts('https://cdn.dhtmlx.com/libs/json2excel/1.3/worker.js');\"\n], { type: \"text/javascript\" }));\n\nvar worker = new Promise((res) =\u003e {\n    const x = Worker(url); \n    worker.addEventListener(\"message\", ev =\u003e {\n        if (ev.data.type === \"ready\"){\n            const json = ev.data.data;\n            // do something with result\n        } else if (ev.data.type === \"init\"){\n            // service is ready\n            res(x);\n        }\n    });\n});\n\nworker.then(x =\u003e x.postMessage({\n    type:\"convert\",\n    data: raw_json_data\n}));\n```\n\n\n### Input format\n\n```ts\ninterface IConvertMessageData {\n    uid?: string;\n    data: ISheetData;\n    styles?: IStyles[];\n    wasmPath?: string; // use cdn by default\n}\n\ninterface IReadyMessageData {\n    uid: string; // same as incoming uid\n    blob: Blob;\n}\n\ninterface ISheetData {\n    name?: string;\n    cols?: IColumnData[];\n    rows?: IRowData[];\n    cells?: IDataCell[][]; // if cells mising, use plain\n    plain?: string[][];\n\n    merged?: IMergedCells;\n}\n\ninterface IMergedCells {\n    from: IDataPoint;\n    to: IDataPoint;\n}\n\ninterface IDataPoint {\n    column: number; \n    row: number;\n}\n\ninterface IColumnData {\n    width: number;\n}\n\ninterface IRowData {\n    height: number;\n}\n\ninterface IDataCell{\n    v: string;\n    s: number;\n}\n\ninterface IStyle {\n    fontSize?: string;\n    align?: string;         // left | center | right\n    verticalAlign?: string; // top | center | bottom\n\n    background?: string;\n    color?: string;\n\n    fontWeight?: string;     // bold\n    fontStyle?: string;      // italic\n    textDecoration?: string; // underline\n\n    format?: string;\n\n    // border valie format: {size} {style} {color}\n    // size: 0.5px | 1px | 2px (works only with 'solid' style)\n    // style: dashed | dotted | double | thin | solid\n    // color: #000 | #000000\n    borderTop?: string;\n    borderRight?: string;\n    borderBottom?: string;\n    borderLeft?: string;\n}\n```\n\n\n### License \n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhtmlx%2Fjson2excel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhtmlx%2Fjson2excel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhtmlx%2Fjson2excel/lists"}