← All packages

@lacspace/xlsx

v1.4.0Data Kit0 deps

Read & write real Excel (.xlsx) with zero dependencies and no headless browser — objects or arrays to a workbook, typed cells (string/number/boolean/Date), per-column number formats, bold headers, column widths, multiple sheets, live Excel formula cells (=B2*C2 with cached values), and built-in CSV↔XLSX conversion. Isomorphic (Node, edge, browser).

npm i @lacspace/xlsx

Usage

xlsx.ts
import { jsonToXlsx } from "@lacspace/xlsx";
import { writeFileSync } from "node:fs";

const bytes = jsonToXlsx([
  { name: "Ada Lovelace", signups: 12, active: true, joined: new Date("2026-01-15") },
  { name: "Alan Turing",  signups: 7,  active: false, joined: new Date("2026-02-01") },
]);

writeFileSync("users.xlsx", bytes);                 // Node
// or serve a download:
return new Response(bytes, {
  headers: {
    "content-type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    "content-disposition": 'attachment; filename="users.xlsx"',
  },
});

// ...and READ one back — bulk import from an uploaded sheet.
// Handles real Excel exports (STORE + DEFLATE), shared strings and dates.
const rows = await xlsxToJson(bytes);
// [{ name: "Ada Lovelace", signups: 12, active: true, joined: <Date> }, ...]

Exports 8

WorkbookaoaToXlsxcolumnLetterjsonToXlsxreadWorkbookxlsxToJsonsheetToJsonsheetToAoa

Keywords

xlsxexcelexcel-exportxlsx-writerspreadsheetexport-to-excel

More in Data Kit