@marcusok/excel-exporter
An Excel export engine built on modern-xlsx (WASM) plus a custom Fast stream writer: declarative API, auto mode routing, full cell styling, Web Worker threading, fast large-file writes and a style-less pure-JS stream fallback.
Capabilities
| Capability | Description |
|---|---|
| Declarative API | Describe exports with sheets + columns + data; no cell-level coding |
| Auto mode routing | auto picks main / worker / Fast stream by row count (20,000 / 50,000 thresholds) |
| Full cell styling | Font, fill, alignment, borders, number formats; 8 built-in StylePresets |
| Value formatting | Structured FormatSpec (enum / date / datetime / number / padding) |
| Worker threading | Main thread only does one structured clone; building runs in a Worker (the ≥ 50k-row stream path does not use WASM) |
| Streaming writes | Custom fast-xlsx.ts + fflate, ~0.8s at 100k rows |
| Layered fallback | Auto-degrades to a style-less fast stream when WASM is unavailable |
| Progress / phase callbacks | onProgress, onPhase for visualizations and telemetry |
Install
bash
pnpm add @marcusok/excel-exporterThat single install brings everything: the export engine (modern-xlsx JS glue + fflate) and the progress overlay UI are bundled into this package's dist at build time, and the WASM / worker assets resolve automatically in bundlers and in Node — configureWasm is only needed for self-hosted copies. See Getting Started.
Quick example
ts
import { exportExcel, StylePresets } from "@marcusok/excel-exporter";
await exportExcel({
filename: "sales-report",
sheets: [
{
name: "Sales",
freezeRows: 1,
autoFilter: true,
columns: [
{ prop: "orderId", label: "Order ID", width: 18 },
{
prop: "amount",
label: "Amount",
width: 14,
style: StylePresets.currency,
},
],
data: [{ orderId: "ORD-001", amount: 9999.99 }],
},
],
});Documentation map
- Guide: installation, auto mode, styles, formatting, advanced features, worker/streaming, fallback, Node/SSR, performance
- Examples: sales report, inventory, large files, multi-sheet workbooks (with mock previews)
- API reference: entry point, types, style presets, FormatSpec
Version & dependencies
- Version: read from the workspace
package.jsonat build time (single source of truth; this site never queries the npm registry) - Runtime dependencies:
modern-xlsx— a types-only entry so published.d.tsfiles resolve external type imports; the engine itself (and the overlay UI) are bundled into this package'sdistat build time, and the WASM binary ships under this package's ownexportsmap - Environment: Node >= 22; browsers need WebAssembly support
Performance numbers are local measurements (real Chrome, 6 mixed-type columns). See Performance.