Skip to content

Excel Output

Output

Write the incoming row stream to a single-sheet .xlsx workbook. Set the filename and the sheet name; column order and headers come from the row keys. Excel Output collects the entire stream in memory before writing because the SheetJS writer is not streaming.

Excel Output is a sink node that consumes a row stream and produces an application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Blob. SheetJS requires the full row set to build a worksheet, so this transform is batch-only — peak memory scales with row count.

The worksheet is built by XLSX.utils.json_to_sheet, which uses the first row’s keys as the header row in row-1 and writes subsequent rows in the order their keys appear. Numeric values stay numeric, strings stay strings, and null/undefined cells are omitted entirely (Excel renders empty cells, not blank strings).

The workbook is tagged with a Comments property identifying FileBender as the generator. The output Blob carries the standard XLSX MIME type so browsers offer the right open-with handlers.

Input: A row stream from any upstream transform. Output: An .xlsx Blob.

OptionTypeDefaultDescription
filenamestringoutput.xlsxSuggested download filename. Must be non-empty.
sheetNamestringSheet1Name of the single worksheet inside the workbook. Must be non-empty.

A monthly revenue report exported to Excel.

Before:

monthrevenuenew_customers
2026-014820014
2026-025190018
2026-035540021

Configuration: defaults — filename: "output.xlsx", sheetName: "Sheet1".

After: an .xlsx workbook with one sheet Sheet1 containing the rows above, with month, revenue, new_customers as the header row.

A finance team wants the file to be called q1-2026-revenue.xlsx with the data on a sheet called Q1.

Before: same rows as above.

Configuration: filename: "q1-2026-revenue.xlsx", sheetName: "Q1".

After: a workbook saved as q1-2026-revenue.xlsx containing one sheet named Q1.

  • Memory scales with the full dataset. Excel Output buffers every row before invoking the SheetJS writer. For inputs above ~100k rows, expect noticeable memory pressure in the browser; use CSV Output if streaming is required. See apps/web/src/transforms/output-xlsx/logic.ts:82-95.
  • Header order comes from the first row’s key order. json_to_sheet derives column headers from the union of keys, but row 1’s key order wins for ties. To fix the column order deterministically, run Reorder Columns immediately upstream. See apps/web/src/transforms/output-xlsx/logic.ts:99-104.
  • Sheet names have an Excel-imposed 31-character limit. SheetJS will truncate or reject names longer than 31 characters and rejects the characters \ / ? * [ ]. The Zod schema only enforces non-empty — invalid names will surface as SheetJS errors at write time. See apps/web/src/transforms/output-xlsx/logic.ts:18-22.
  • CSV Output — write plain text CSV instead of binary .xlsx (streaming, lower memory).
  • JSON Output — write a JSON array or NDJSON when the consumer is a script or API.
  • Reorder Columns — fix column order before serialisation.