High-performance XLSX read/write for JavaScript and TypeScript. Full styling, validation, and formatting — powered by Rust + WASM. Everything SheetJS Pro charges for, free and open source.
npm install modern-xlsx
Everything you need for production XLSX handling, without the paywall.
Fonts, fills, borders, alignment, text rotation, shrink-to-fit. Fluent builder API produces style indices for any cell.
Built-in Excel format codes plus custom formats. Dates, currency, percentages, scientific notation — all rendered correctly.
List, whole number, decimal, date, time, text length, and custom formula validators with error messages.
Color scales, data bars, icon sets, and formula-based rules. Read and write preserving all OOXML attributes.
Freeze rows, columns, or both. Maintains scroll position for large worksheets.
Internal sheet links, external URLs, email links — with display text and tooltips.
Add, read, and remove cell comments with author attribution.
Protect worksheets with granular permissions — lock formatting, insertion, deletion, sorting, and filtering independently.
Read and write password-protected XLSX files. ECMA-376 Agile Encryption with AES-256 and SHA-512.
Paper size, orientation, margins, headers, footers — full print configuration.
First-class support for the Temporal API alongside classic Date objects. Future-proof date handling.
Rust core compiled to WASM. ZIP decompression and XML parsing run at near-native speed inside the WASM sandbox.
Pure ESM with zero runtime dependencies. Import only what you need — bundlers eliminate the rest.
Benchmarked with a 100,000-row workbook. Node.js, single thread.
Create a styled spreadsheet in under 30 lines.
import { initWasm, Workbook, readFile } from 'modern-xlsx'; await initWasm(); // Create a new workbook const wb = new Workbook(); const ws = wb.addSheet('Sales'); ws.cell('A1').value = 'Product'; ws.cell('B1').value = 'Revenue'; ws.cell('A2').value = 'Widget'; ws.cell('B2').value = 9999.99; // Style headers const header = wb.createStyle() .font({ bold: true, size: 14, color: '1F4E79' }) .fill({ pattern: 'solid', fgColor: 'D6E4F0' }) .alignment({ horizontal: 'center' }) .build(wb.styles); ws.cell('A1').styleIndex = header; ws.cell('B1').styleIndex = header; // Currency format const currency = wb.createStyle() .numberFormat('$#,##0.00') .build(wb.styles); ws.cell('B2').styleIndex = currency; await wb.toFile('sales.xlsx'); // Read an existing file const existing = await readFile('report.xlsx'); console.log(existing.getSheet('Sheet1')?.cell('A1').value);
Full documentation available in the package README.
| Category | Functions / Classes |
|---|---|
| Core | initWasm() · Workbook · Worksheet · Cell |
| I/O | readFile() · readBuffer() · toFile() · toBuffer() · writeBlob() |
| Styles | StyleBuilder — .font() .fill() .border() .alignment() .numberFormat() .build() |
| Conversions | aoaToSheet() · jsonToSheet() · sheetToJson() · sheetToCsv() · sheetToHtml() |
| Dates | dateToSerial() · serialToDate() · isDateFormatId() |
| Formatting | formatCell() · getBuiltinFormat() |
| Cell Refs | encodeCellRef() · decodeCellRef() · encodeRange() · decodeRange() |
| Rich Text | RichTextBuilder — .text() .bold() .italic() .styled() .build() |
Hybrid Rust + TypeScript design for maximum performance and developer experience.
serde_wasm_bindgen
for large workbooks (100K+ rows). The Rust core handles ZIP compression, SAX-style XML parsing,
shared string table construction, and style resolution. The writer builds the SST inline during
XML generation, avoiding a full worksheet clone.
How modern-xlsx stacks up against SheetJS Community and Pro editions.
| Feature | modern-xlsx | SheetJS CE | SheetJS Pro |
|---|---|---|---|
| Read / write XLSX | Free | Free | Paid |
| Cell styling | Free | No | Paid |
| Number formats | Free | Read only | Paid |
| Data validation | Free | No | Paid |
| Conditional formatting | Free | No | Paid |
| Comments | Free | Read only | Paid |
| Rich text | Free | No | Paid |
| Sheet protection | Free | Read only | Paid |
| Frozen panes | Free | Partial | Paid |
| Temporal API dates | Yes | No | No |
| Available on npm | Yes | CDN only | No |
| Tree-shakable ESM | Yes | No | No |
| TypeScript types | Built-in | Partial | Partial |
| WASM-accelerated | Yes | No | No |
| OOXML validation & repair | Yes | No | No |
| Barcode & QR code generation | Yes | No | No |
| Image embedding | Yes | No | Paid |
| Encryption (password protection) | Yes | No | No |