{"id":17918901,"url":"https://github.com/xuri/excelize-wasm","last_synced_at":"2025-04-08T10:26:15.482Z","repository":{"id":60041665,"uuid":"537113046","full_name":"xuri/excelize-wasm","owner":"xuri","description":"A WebAssembly build of the Go Excelize library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets","archived":false,"fork":false,"pushed_at":"2024-10-24T11:40:09.000Z","size":424,"stargazers_count":198,"open_issues_count":8,"forks_count":34,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-10-25T10:59:19.062Z","etag":null,"topics":["ecma-376","excel","excelize","formula","go","golang","javascript","js","microsoft","npm","office","ooxml","spreadsheet","ts","typescript","vba","wasm","webassembly","xlsm","xlsx"],"latest_commit_sha":null,"homepage":"https://xuri.me/excelize","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"xuri","open_collective":"excelize","patreon":"xuri","ko_fi":"xurime","liberapay":"xuri","issuehunt":"xuri","custom":"https://www.paypal.com/paypalme/xuri"}},"created_at":"2022-09-15T16:27:17.000Z","updated_at":"2024-10-24T16:19:07.000Z","dependencies_parsed_at":"2024-06-28T15:33:27.699Z","dependency_job_id":"0b60e42d-717d-4088-b3fd-182391ccac78","html_url":"https://github.com/xuri/excelize-wasm","commit_stats":{"total_commits":65,"total_committers":10,"mean_commits":6.5,"dds":"0.16923076923076918","last_synced_commit":"413e1f1cc67ea0edf37e8ec42102fca1f9bea6c6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuri","download_url":"https://codeload.github.com/xuri/excelize-wasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247822304,"owners_count":21001834,"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":["ecma-376","excel","excelize","formula","go","golang","javascript","js","microsoft","npm","office","ooxml","spreadsheet","ts","typescript","vba","wasm","webassembly","xlsm","xlsx"],"created_at":"2024-10-28T20:13:22.029Z","updated_at":"2025-04-08T10:26:15.445Z","avatar_url":"https://github.com/xuri.png","language":"Go","readme":"# excelize-wasm\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"500\" src=\"https://github.com/xuri/excelize-wasm/raw/main/excelize-wasm.svg\" alt=\"excelize-wasm logo\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/excelize-wasm\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/excelize-wasm.svg\" alt=\"NPM version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/xuri/excelize-wasm/actions/workflows/go.yml\"\u003e\u003cimg src=\"https://github.com/xuri/excelize-wasm/actions/workflows/go.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/xuri/excelize-wasm\"\u003e\u003cimg src=\"https://codecov.io/gh/xuri/excelize-wasm/branch/main/graph/badge.svg\" alt=\"Code Coverage\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/xuri/excelize-wasm/cmd\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/xuri/excelize-wasm/cmd\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/xuri/excelize/v2\"\u003e\u003cimg src=\"https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\" alt=\"go.dev\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/BSD-3-Clause\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-bsd-orange.svg\" alt=\"Licenses\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.paypal.com/paypalme/xuri\"\u003e\u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-green.svg\" alt=\"Donate\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nExcelize-wasm is a pure WebAssembly / Javascript port of Go [Excelize](https://github.com/xuri/excelize) library that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel\u0026trade; 2007 and later. Supports complex components by high compatibility. The full API docs can be found at [docs reference](https://xuri.me/excelize/).\n\n## Environment Compatibility\n\nBrowser | Version\n---|---\nChrome | \u0026ge;57\nChrome for Android and Android Browser | \u0026ge;105\nEdge | \u0026ge;16\nSafari on macOS and iOS | \u0026ge;11\nFirefox | \u0026ge;52\nFirefox for Android | \u0026ge;104\nOpera | \u0026ge;44\nOpera Mobile | \u0026ge;64\nSamsung Internet | \u0026ge;7.2\nUC Browser for Android | \u0026ge;13.4\nQQ Browser | \u0026ge;10.4\nNode.js | \u0026ge;12.0.0\nDeno | \u0026ge;1.0\n\n## Basic Usage\n\n### Installation\n\n#### Node.js\n\n```bash\nnpm install --save excelize-wasm\n```\n\n#### Browser\n\n```html\n\u003cscript src=\"excelize-wasm/index.js\"\u003e\u003c/script\u003e\n```\n\n### Create spreadsheet\n\nHere is a minimal example usage that will create spreadsheet file.\n\n```javascript\nconst { init } = require('excelize-wasm');\nconst fs = require('fs');\n\ninit('./node_modules/excelize-wasm/excelize.wasm.gz').then((excelize) =\u003e {\n  const f = excelize.NewFile();\n  if (f.error) {\n    console.log(f.error);\n    return;\n  }\n  // Create a new sheet.\n  const { index } = f.NewSheet('Sheet2');\n  // Set value of a cell.\n  f.SetCellValue('Sheet2', 'A2', 'Hello world.');\n  f.SetCellValue('Sheet1', 'B2', 100);\n  // Set active sheet of the workbook.\n  f.SetActiveSheet(index);\n  // Save spreadsheet by the given path.\n  const { buffer, error } = f.WriteToBuffer();\n  if (error) {\n    console.log(error);\n    return;\n  }\n  fs.writeFile('Book1.xlsx', buffer, 'binary', (error) =\u003e {\n    if (error) {\n      console.log(error);\n    }\n  });\n});\n```\n\nCreate spreadsheet in browser:\n\n\u003cdetails\u003e\n  \u003csummary\u003eView code\u003c/summary\u003e\n\n```html\n\u003chtml\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003cscript src=\"https://\u003cyour_hostname\u003e/excelize-wasm/index.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cdiv\u003e\n    \u003cbutton onclick=\"download()\"\u003eDownload\u003c/button\u003e\n  \u003c/div\u003e\n  \u003cscript\u003e\n  function download() {\n    excelizeWASM\n      .init('https://\u003cyour_hostname\u003e/excelize-wasm/excelize.wasm.gz')\n      .then((excelize) =\u003e {\n        const f = excelize.NewFile();\n        if (f.error) {\n          console.log(f.error);\n          return;\n        }\n        // Create a new sheet.\n        const { index } = f.NewSheet('Sheet2');\n        // Set value of a cell.\n        f.SetCellValue('Sheet2', 'A2', 'Hello world.');\n        f.SetCellValue('Sheet1', 'B2', 100);\n        // Set active sheet of the workbook.\n        f.SetActiveSheet(index);\n        // Save spreadsheet by the given path.\n        const { buffer, error } = f.WriteToBuffer();\n        if (error) {\n          console.log(error);\n          return;\n        }\n        const link = document.createElement('a');\n        link.download = 'Book1.xlsx';\n        link.href = URL.createObjectURL(\n          new Blob([buffer], {\n            type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n          })\n        );\n        link.click();\n      });\n  }\n  \u003c/script\u003e\n\u003c/body\u003e\n```\n\n\u003c/details\u003e\n\n### Reading spreadsheet\n\nThe following constitutes the bare to read a spreadsheet document.\n\n```javascript\nconst { init } = require('excelize-wasm');\nconst fs = require('fs');\n\ninit('./node_modules/excelize-wasm/excelize.wasm.gz').then((excelize) =\u003e {\n  const f = excelize.OpenReader(fs.readFileSync('Book1.xlsx'));\n  if (f.error) {\n    console.log(f.error);\n    return;\n  }\n  // Set value of a cell.\n  const ret1 = f.GetCellValue('Sheet1', 'B2');\n  if (ret1.error) {\n    console.log(ret1.error);\n    return;\n  }\n  console.log(ret1.value);\n  // Get all the rows in the Sheet1.\n  const ret2 = f.GetRows('Sheet1');\n  if (ret2.error) {\n    console.log(ret2.error);\n    return;\n  }\n  ret2.result.forEach((row) =\u003e {\n    row.forEach((colCell) =\u003e {\n      process.stdout.write(`${colCell}\\t`);\n    });\n    console.log();\n  });\n});\n```\n\n### Add chart to spreadsheet file\n\nWith excelize-wasm chart generation and management is as easy as a few lines of code. You can build charts based on data in your worksheet or generate charts without any data in your worksheet at all.\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"650\" src=\"https://raw.githubusercontent.com/xuri/excelize-wasm/main/chart.png\" alt=\"Create chart by excelize-wasm\"\u003e\u003c/p\u003e\n\n```javascript\nconst { init } = require('excelize-wasm');\nconst fs = require('fs');\n\ninit('./node_modules/excelize-wasm/excelize.wasm.gz').then((excelize) =\u003e {\n  const f = excelize.NewFile();\n  if (f.error) {\n    console.log(f.error);\n    return;\n  }\n  [\n    [null, 'Apple', 'Orange', 'Pear'],\n    ['Small', 2, 3, 3],\n    ['Normal', 5, 2, 4],\n    ['Large', 6, 7, 8],\n  ].forEach((row, idx) =\u003e {\n    const ret1 = excelize.CoordinatesToCellName(1, idx + 1);\n    if (ret1.error) {\n      console.log(ret1.error);\n      return;\n    }\n    const res2 = f.SetSheetRow('Sheet1', ret1.cell, row);\n    if (res2.error) {\n      console.log(res2.error);\n      return;\n    }\n  });\n  const ret3 = f.AddChart('Sheet1', 'E1', {\n    Type: excelize.Col3DClustered,\n    Series: [\n      {\n        Name: 'Sheet1!$A$2',\n        Categories: 'Sheet1!$B$1:$D$1',\n        Values: 'Sheet1!$B$2:$D$2',\n      },\n      {\n        Name: 'Sheet1!$A$3',\n        Categories: 'Sheet1!$B$1:$D$1',\n        Values: 'Sheet1!$B$3:$D$3',\n      },\n      {\n        Name: 'Sheet1!$A$4',\n        Categories: 'Sheet1!$B$1:$D$1',\n        Values: 'Sheet1!$B$4:$D$4',\n      },\n    ],\n    Title: [{\n      Text: 'Fruit 3D Clustered Column Chart',\n    }],\n  });\n  if (ret3.error) {\n    console.log(ret3.error);\n    return;\n  }\n  // Save spreadsheet by the given path.\n  const { buffer, error } = f.WriteToBuffer();\n  if (error) {\n    console.log(error);\n    return;\n  }\n  fs.writeFile('Book1.xlsx', buffer, 'binary', (error) =\u003e {\n    if (error) {\n      console.log(error);\n    }\n  });\n});\n```\n\n### Add picture to spreadsheet file\n\n```javascript\nconst { init } = require('excelize-wasm');\nconst fs = require('fs');\n\ninit('./node_modules/excelize-wasm/excelize.wasm.gz').then((excelize) =\u003e {\n  const f = excelize.OpenReader(fs.readFileSync('Book1.xlsx'));\n  if (f.error) {\n    console.log(f.error);\n    return;\n  }\n  // Insert a picture.\n  const ret1 = f.AddPictureFromBytes('Sheet1', 'A2', {\n    Extension: '.png',\n    File: fs.readFileSync('image.png'),\n    Format: { AltText: 'Picture 1' },\n  });\n  if (ret1.error) {\n    console.log(ret1.error);\n    return;\n  }\n  // Insert a picture to worksheet with scaling.\n  const ret2 = f.AddPictureFromBytes('Sheet1', 'D2', {\n    Extension: '.jpg',\n    File: fs.readFileSync('image.jpg'),\n    Format: { AltText: 'Picture 2', ScaleX: 0.5, ScaleY: 0.5 },\n  });\n  if (ret2.error) {\n    console.log(ret2.error);\n    return;\n  }\n  // Insert a picture offset in the cell with printing support.\n  const ret3 = f.AddPictureFromBytes('Sheet1', 'H2', {\n    Extension: '.gif',\n    File: fs.readFileSync('image.gif'),\n    Format: {\n      AltText: 'Picture 3',\n      OffsetX: 15,\n      OffsetY: 10,\n      PrintObject: true,\n      LockAspectRatio: false,\n      Locked: false,\n    },\n  });\n  if (ret3.error) {\n    console.log(ret3.error);\n    return;\n  }\n  // Save spreadsheet by the given path.\n  const { buffer, error } = f.WriteToBuffer();\n  if (error) {\n    console.log(error);\n    return;\n  }\n  fs.writeFile('Book1.xlsx', buffer, 'binary', (error) =\u003e {\n    if (error) {\n      console.log(error);\n    }\n  });\n});\n```\n\n## Contributing\n\nContributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.\n\n## Licenses\n\nThis program is under the terms of the BSD 3-Clause License. See [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause).\n\nThe Excel logo is a trademark of [Microsoft Corporation](https://aka.ms/trademarks-usage). This artwork is an adaptation.\n\ngopher.{ai,svg,png} was created by [Takuya Ueda](https://twitter.com/tenntenn). Licensed under the [Creative Commons 3.0 Attributions license](http://creativecommons.org/licenses/by/3.0/).\n","funding_links":["https://github.com/sponsors/xuri","https://opencollective.com/excelize","https://patreon.com/xuri","https://ko-fi.com/xurime","https://liberapay.com/xuri","https://issuehunt.io/r/xuri","https://www.paypal.com/paypalme/xuri"],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuri%2Fexcelize-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuri%2Fexcelize-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuri%2Fexcelize-wasm/lists"}