typed-xlsx
Getting Started

Installation

Install typed-xlsx, the three entry points you will use, and which runtimes it supports.
pnpm add typed-xlsx

typed-xlsx has no runtime dependencies and ships as ESM only.

The three functions you start from

FunctionUse it to
createExcelSchema<T>()describe the report: columns, formulas, styles, summaries
createWorkbook()build a workbook from rows you already have in memory
createWorkbookStream()build a workbook by committing rows in batches, for large exports
import { 
createExcelSchema
,
createWorkbook
} from "typed-xlsx";
type
User
= {
firstName
: string;
email
: string };
const
schema
=
createExcelSchema
<
User
>()
.
column
("firstName", {
header
: "First name",
accessor
: "firstName" })
.
column
("email", {
header
: "Email",
accessor
: "email" })
.
build
();
const
workbook
=
createWorkbook
();
workbook
.
sheet
("Users").
table
("users", {
rows
: [{
firstName
: "Ada",
email
: "ada@example.com" }],
schema
,
}); const
bytes
=
workbook
.
toUint8Array
();

Runtimes

Schemas, both builders, toUint8Array() and the streaming builder's Web outputs (toReadableStream(), pipeTo()) run in Node.js, Bun, Deno and edge runtimes such as Cloudflare Workers.

A few outputs depend on Node APIs and load them only when called:

NeedsFeature
Node BuffertoBuffer()
Node streamspipeToNode(), toNodeReadable()
a writable filesystemwriteToFile(), and the streaming builder's default temp storage (use tempStorage: "memory" without one)

The buffered builder (createWorkbook()) compresses the file with Node's zlib, which Node.js, Bun and Deno provide. In runtimes that don't expose it, such as Cloudflare Workers or a browser, the workbook still opens in Excel but its parts are stored uncompressed, so the file is much larger (a 20,000-row, three-column test went from 294 KB to 3.1 MB). The streaming builder compresses with the Web CompressionStream instead, where the runtime has one.

Next steps

Copyright © 2026 Cyprien Thao. Released under the MIT License.