{"id":13477982,"url":"https://github.com/DHTMLX/excel2json","last_synced_at":"2025-03-27T07:30:36.137Z","repository":{"id":34206837,"uuid":"170673141","full_name":"DHTMLX/excel2json","owner":"DHTMLX","description":"Convert excel file to json data","archived":false,"fork":false,"pushed_at":"2023-11-16T17:28:33.000Z","size":661,"stargazers_count":88,"open_issues_count":6,"forks_count":18,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-25T03:18:39.155Z","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}},"created_at":"2019-02-14T10:28:11.000Z","updated_at":"2024-04-23T02:13:44.000Z","dependencies_parsed_at":"2023-11-16T17:55:27.803Z","dependency_job_id":null,"html_url":"https://github.com/DHTMLX/excel2json","commit_stats":{"total_commits":12,"total_committers":5,"mean_commits":2.4,"dds":0.5833333333333333,"last_synced_commit":"1fc16c4633c4968f29be12063042c428ae54a176"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fexcel2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fexcel2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fexcel2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DHTMLX%2Fexcel2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DHTMLX","download_url":"https://codeload.github.com/DHTMLX/excel2json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245802150,"owners_count":20674596,"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-07-31T16:01:50.847Z","updated_at":"2025-03-27T07:30:35.744Z","avatar_url":"https://github.com/DHTMLX.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"Excel2json\n--------------\n\nExcel2json is a Rust and WebAssembly-based library that allows easily converting files in Excel format to JSON files.\n\n[![npm version](https://badge.fury.io/js/excel2json-wasm.svg)](https://badge.fury.io/js/excel2json-wasm) \n\n### How to build\n\n#### wasm\n\n```\ncargo install wasm-pack\nwasm-pack build\n```\n\n\n### How to use via npm\n\n- install the module\n\n```js\nyarn add excel2json-wasm\n```\n- import and use the module\n\n```js\n// worker.js\nimport {convert} \"excel2json-wasm\";\n// convert int-array, works in sync mode\nconst json = convertArray(Int8Array, optional_config);\n// converts file object or int-array in async mode\nconvert(file_object_or_typed_array, optional_config).then(json =\u003e {\n    // do something\n});\n```\n\n\n### How to use from CDN\n\nCDN links are the following:\n\n- https://cdn.dhtmlx.com/libs/excel2json/1.2/worker.js \n- https://cdn.dhtmlx.com/libs/excel2json/1.2/module.js \n- https://cdn.dhtmlx.com/libs/excel2json/1.2/excel2json_wasm_bg.wasm\n\n\nYou can import and use lib dynamically like \n\n```js\nconst convert = import(\"https://cdn.dhtmlx.com/libs/excel2json/1.2/module.js\");\nconst blob = convert(json_data_to_export);\n```\n\nor use it as web worker\n\n```js\nvar url = window.URL.createObjectURL(new Blob([\n    \"importScripts('https://cdn.dhtmlx.com/libs/excel2json/1.2/worker.js');\"\n], { type: \"text/javascript\" }));\n\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 json = ev.data.data;\n        // do something\n    }\n});\nworker.postMessage({\n    type:\"convert\",\n    data: file_object\n});\nworker.addEventListener(\"message\", e =\u003e {\n    if (e.data.init){\n        // worker is ready\n    }\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/excel2json/1.2/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: file_object\n}));\n```\n\n#### Export formulas\n\n\n```js\nconst json = convert(data, { formulas:true });\n```\n\nor\n\n```js\nworker.postMessage({\n    type: \"convert\",\n    data: file_object_or_typed_array,\n    formulas: true\n});\n```\n\n### Output format\n\n```ts\ninterface IConvertMessageData {\n    uid?: string;\n    data: Uint8Array | File;\n    sheet?: string;\n    styles?: boolean;\n    wasmPath?: string;\n}\n\ninterface IReadyMessageData {\n    uid: string;\n    data: ISheetData[];\n    styles: IStyles[];\n}\n\ninterface ISheetData {\n    name: string;\n    cols: IColumnData[];\n    rows: IRowData[];\n    cells: IDataCell[][];   // null for empty cell\n\n    merged: IMergedCell[];\n}\n\ninterface IMergedCell {\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    fontFamily?: string;\n\n    background?: string;\n    color?: string;\n\n    fontWeight?: string;\n    fontStyle?: string;\n    textDecoration?: string;\n\n    align?: string;\n    verticalAlign?: string;\n\n    borderLeft?: string;\n    borderTop?: string;\n    borderBottom?: string;\n    borderRight?: string;\n\n    format?: string;\n}\n```\n\n### License \n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDHTMLX%2Fexcel2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDHTMLX%2Fexcel2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDHTMLX%2Fexcel2json/lists"}