Introduction
typed-xlsx is a TypeScript-first library for generating XLSX files. It ships with its own OOXML serialization and ZIP assembly engine — no SheetJS dependency, no wrapper around another library's limitations.
What problems does it solve?
Excel generation has a low ceiling in most libraries
Most Excel libraries for Node.js give you a row/cell model that gets unwieldy fast. Once you need multi-row expansion from arrays, column summaries, per-row conditional styling, freeze panes, and multi-table sheet layouts, you end up building a framework on top of a framework. typed-xlsx provides that layer as a first-class public API.
Streaming was an afterthought everywhere else
Other libraries advertise streaming but still materialize the full workbook before writing. typed-xlsx has two separate builders: a buffered one for normal workbooks and a streaming one that serializes incrementally and pipes directly into the ZIP writer. Peak memory scales with your batch size, not your dataset size.
Schemas need to be reusable across different export shapes
A common pattern is one canonical schema used for multiple exports — full data, filtered columns, different audience. The builder system (createExcelSchema()) produces a plain definition object that carries no state, so it can be passed to any number of tables across multiple workbooks without side effects.
What you get
- Typed accessor layer — dot-path strings (
"user.address.city") and callback functions (row => ...) both resolve with full TypeScript inference against your row type. - Reducer-based summaries — summaries accumulate row by row with
init/step/finalize. The same schema definition works in both buffered and stream exports. - Library-owned
CellStyle— styles are defined with the library's own normalized type, independent of any backend serializer. - Custom OOXML + ZIP engine — the output pipeline writes raw XML and assembles the ZIP archive without any third-party spreadsheet library in the call stack.
- Real streaming —
createWorkbookStream()writes each sheet incrementally to a spool (file or memory), then pipes the ZIP archive to any Node writable, Web writable, file, or readable stream. - Multi-table layouts — multiple tables per sheet with configurable column/row gaps and grid placement.
- Freeze panes and RTL sheets — first-class sheet view options for both builders.
When to use typed-xlsx
Use typed-xlsx when your data has a known structure and your reports need consistent column definitions, summaries, and styling. It is not designed for fully dynamic layouts where the row/column structure is unknown at code time.
| Scenario | Recommendation |
|---|---|
| Regular reports from typed data models | typed-xlsx |
| Streaming exports of 100k+ rows | typed-xlsx with createWorkbookStream() |
| Fully dynamic workbook where shape is runtime-determined | Lower-level library |
| Reusing one schema definition across multiple export views | typed-xlsx |