Lightweight (<10KB) XLSX file creator for Browser and Node.js.
Why?
Sometimes you just want to add Download as Excel button next to Download as csv.
Sometimes you just want to send a simple xlsx with email without adding 30MB of packages.
const { createXlsx } = require("@litejs/xlsx");
const fileAsUint8Array = await createXlsx({
sheets: [
{
name: 'Products',
cols: '20,10,10', // Simple column widths
data: [
['Apple', 1.99, 10],
['Banana', 0.99, 15],
['Orange', 2.49, 8],
['Totals', '=SUM(B1:B3)', {style: 'bold', value: '=SUM(C1:C3)'}]
]
},
{
name: 'Types',
cols: '20,40',
data: [
['true', true],
['false', false],
['Default Date', new Date(1514900750001)],
['Datetime', { format: 'datetime', value: new Date(1514900750001) }],
['Date', { format: 'date', value: new Date(1514900750001) }],
]
},
]
})Follow Coding Style Guide,
run tests npm install; npm test.
Copyright (c) 2025 Lauri Rooden <lauri@rooden.ee>
MIT License | GitHub repo | npm package | Buy Me A Tea