Skip to content

Distribution files

The WebAssembly module is embedded in the JavaScript files. You do not need a separate .wasm download or a readiness Promise. Use the file that matches your host and required formats.

Package path Purpose
xlsx.js Main CommonJS/UMD entry for Node and bundlers; resolved by require("@agent-sheet/wasm")
dist/xlsx.full.min.js Full browser distribution, with codepage tables included; defines the global XLSX
dist/xlsx.mini.min.js Reduced browser distribution with fewer formats and no stream namespace
dist/cpexcel.js Optional codepage tables; register its export with set_cptable
dist/xlsx.zahl.js Data payload required for Numbers output
dist/shim.min.js ES5 polyfills for an application; it does not remove the library’s WebAssembly requirement
types/index.d.ts TypeScript declarations used by the package entry
dist/agent-sheet.wasm Compiled engine; requires the SDK’s JavaScript host, not a standalone module
dist/cpexcel.LICENSE Apache-2.0 license for the optional codepage tables
README.md SDK introduction and usage notes
LICENSE Elastic License 2.0 with engine limitations: free use, including commercial
package.json Package metadata, Node.js requirement and entry points

CommonJS uses require("@agent-sheet/wasm"). ES modules use the default import import XLSX from "@agent-sheet/wasm"; Node named imports are not supported.

const XLSX = require("@agent-sheet/wasm");
const assert = require("node:assert/strict");
assert.equal(typeof XLSX.read, "function");
assert.equal(typeof XLSX.utils.aoa_to_sheet, "function");

Node 22 and 24 are supported and tested. Older Node releases are untested.

Copy the distribution file to a location served by your application. This browser example assumes the file is served at /vendor/xlsx.full.min.js:

<script src="/vendor/xlsx.full.min.js"></script>
<script>
const sheet = XLSX.utils.aoa_to_sheet([["Name", "Count"], ["Books", 5]]);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, sheet, "Inventory");
XLSX.writeFile(workbook, "inventory.xlsx");
</script>

Current Chromium and Firefox, pages and Web Workers, are tested. Safari is untested. A strict Content-Security-Policy must permit WebAssembly compilation with 'wasm-unsafe-eval'. There is no JavaScript-only fallback.

The full distribution includes codepage tables. With a distribution that does not include them, register the optional tables when needed:

const XLSX = require("@agent-sheet/wasm");
const codepages = require("@agent-sheet/wasm/dist/cpexcel.js");
XLSX.set_cptable(codepages);

The payload is not loaded by requiring the main package. Pass it to the writer:

const XLSX = require("@agent-sheet/wasm");
const assert = require("node:assert/strict");
const numbers = require("@agent-sheet/wasm/dist/xlsx.zahl.js");
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, XLSX.utils.aoa_to_sheet([["Budget", 100]]), "Plan");
const data = XLSX.write(workbook, { type: "buffer", bookType: "numbers", numbers });
assert.equal(XLSX.read(data).Sheets.Plan.A1.v, "Budget");

This checks library read/write behavior, not opening the result in the Apple Numbers application. Application behavior is untested.

Choose mini only when its format set meets your needs. It reads XLSX, ODS, CSV, text, SYLK, DIF, DBF, PRN and Ethercalc, and writes those formats plus XLSM. It omits stream and parse_xlscfb. Unsupported formats fail rather than falling back to the full distribution.

See Supported formats for the full matrix.

The CommonJS entry works with esbuild and similar bundlers. esbuild, AMD define("xlsx"), and plain script globals are tested. Node filesystem and stream APIs are not browser APIs; use in-memory read/write or browser writeFile downloads rather than expecting Node file access in a browser.

No CLI ships with the package. Use the JavaScript API for conversion and disk I/O. The raw dist/agent-sheet.wasm requires the SDK’s JavaScript host; do not instantiate it directly. Load the SDK entry or a browser bundle instead.