Skip to content

@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 ​

CapabilityDescription
Declarative APIDescribe exports with sheets + columns + data; no cell-level coding
Auto mode routingauto picks main / worker / Fast stream by row count (20,000 / 50,000 thresholds)
Full cell stylingFont, fill, alignment, borders, number formats; 8 built-in StylePresets
Value formattingStructured FormatSpec (enum / date / datetime / number / padding)
Worker threadingMain thread only does one structured clone; building runs in a Worker (the ≥ 50k-row stream path does not use WASM)
Streaming writesCustom fast-xlsx.ts + fflate, ~0.8s at 100k rows
Layered fallbackAuto-degrades to a style-less fast stream when WASM is unavailable
Progress / phase callbacksonProgress, onPhase for visualizations and telemetry

Install ​

bash
pnpm add @marcusok/excel-exporter

That 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.json at build time (single source of truth; this site never queries the npm registry)
  • Runtime dependencies: modern-xlsx — a types-only entry so published .d.ts files resolve external type imports; the engine itself (and the overlay UI) are bundled into this package's dist at build time, and the WASM binary ships under this package's own exports map
  • Environment: Node >= 22; browsers need WebAssembly support

Performance numbers are local measurements (real Chrome, 6 mixed-type columns). See Performance.