Skip to content

litejs/xlsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiteJS Xlsx – Coverage Size Buy Me A Tea

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.

Examples

const { createXlsx } = require("@litejs/xlsx");
const fileAsUint8Array = await createXlsx({
    styles: {
        My1: {
            font: { sz: 15, name: "Calibri" },
            fill: "FFFF00",
        },
    },
    sheets: [
        {
            name: 'Products',
            freeze: { rows: 1, cols: 0 },
            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) }],
            ]
        },
        {
            name: 'Styles',
            data: [
                [{ style: 'My1', value: 'Cell with custom stype'}, 1],
                { height: 25, data: ['Row with custom height', 2] },
            ]
        },
    ]
})

Contributing

Follow Coding Style Guide, run tests npm install; npm test.

Copyright (c) 2025-2026 Lauri Rooden <lauri@rooden.ee>
MIT License | GitHub repo | npm package | Buy Me A Tea

About

Create XLSX files in Browser or Server

Resources

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project