toXlsxTable(workbook, store, options?) returns Promise<Uint8Array>. grid.exportXlsx uses this contract: active sheet only, synthesized first-row column headers, and resolved scalars instead of formula source. Styles, borders, number/date formats, merges, column widths and row heights are preserved on active-sheet export. Frozen panes, active worksheet state and names are not table round-trip state.
Workbook interchange
toXlsxWorkbook(snapshot, options?) returns Promise<Uint8Array> from the same WorkbookSnapshot used by persistence. It does not synthesize a header row.
Feature
Workbook result
Worksheets, order and active sheet
Preserved.
Formula source, including cross-sheet formulas
Preserved; requests full recalculation on open.
Styles, borders, number/date formats, merges, dimensions and frozen panes
Preserved.
Named ranges and native booleans
Preserved.
HTTPS/mailto and internal range hyperlinks
Preserved, with stable IDs in Sheetwrite metadata.
Supported ordered conditional formats
Native rules preserve priority and stop behavior.
Tables
Autofilter rules, sort state, calculated-column formulas and totals-row functions round-trip.
Every dropped native feature is reported through onWarning (XlsxWorkbookWarning). Surface these warnings when fidelity matters. Import limits and conditional-rule support describe the supported subset.
Errors and built-in actions
grid.exportXlsx(...) rejects on missing registration or encoding failure and preserves the backend error. The four buffered table/workbook import/export functions are asynchronous. Missing registration and codec failures reject with SheetwriteError; inspect code, not the installation message. Resource failures remain XlsxResourceError instances and satisfy isSheetwriteError.
Built-in toolbar and context-menu actions show an alert and emit one export-error event with { format: "csv" | "xlsx", error }:
grid.actions.exportXlsx() returns a promise that resolves after the command finishes, including when export fails. Built-in buttons ignore repeated starts for the same pending command and show a busy state.
XLSX backends
Core and framework entry points do not resolve the optional codec. Register it before invoking XLSX functions or framework toolbar actions. A missing backend error names both remedies: install @sheetwrite/xlsx, then import @sheetwrite/xlsx/register.
The root @sheetwrite/xlsx entry is side-effect free. Its ./register entry registers idempotently. Explicit registration and individual backend composition are also public:
Hosts can implement XlsxWorkbookBackend, XlsxTableExportBackend, or XlsxTableImportBackend to replace a role. @sheetwrite/xlsx is the only concrete implementation package. Its bounded OOXML codec owns OPC part resolution, XML tokenization, styles and worksheet mapping over the audited compression primitive fflate.
Options and limits
All XLSX paths share XlsxWorkbookOptions: maxCells, resourceLimits, signal and onWarning. See resource limits and streaming before increasing a budget. Buffered export holds its output in memory.