Install
xlsx-kit ships as ESM-only. Pick the entry that matches your runtime.
Package install
pnpm add xlsx-kit
# or
npm install xlsx-kit
# or
bun add xlsx-kit Requires Node >=18.18 for the built-in Web Streams, Blob, and fetch globals. Modern browsers (Chromium, Firefox, Safari with Web Streams) work with the streaming entry. Bun and Deno work via Web Streams.
Subpath entries
| Import | Use case |
|---|---|
xlsx-kit | Full library: workbook model, charts, drawings. |
xlsx-kit/streaming | Read-only iter + write-only append. Browser-safe. |
xlsx-kit/node | Filesystem fromFile / toFile + Node Readable / Writable glue, plus the full lib. |
Bundle budgets, min + brotli:
xlsx-kit≤ 120 KB (currently ~78 KB)xlsx-kit/streaming≤ 80 KB (currently ~47 KB)
All exports are side-effect-free ("sideEffects": false), so unused chart / drawing / pivot code drops out under any modern bundler.
TypeScript
Types are bundled. tsconfig.json should have "moduleResolution": "bundler" (or "node16" / "nodenext") so the subpath entries resolve.
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true
}
} What’s not in the box
- ZIP64 write — fflate’s writer doesn’t emit ZIP64 EOCD, so we fail fast on workbooks with > 65 535 entries. Read works.
- Random-access streaming reader — the SAX
iterRowsAPI is in place; per-cell random access against a streaming source is buffered. - Encrypted xlsx decryption — we detect CFB Compound Documents and throw a clear error pointing at
msoffcrypto-tool; decrypt first, then load.
Next: Getting started →