ExcelJS
Library to read and write XLSX workbooks with styling, formulas, streams and cell formatting.
Official Documentation ↗exceljs v4.x / Node 18 LTS. Check the official docs for the latest API surface.Installation
npm install exceljspnpm add exceljsyarn add exceljsMethods
No methods match this filter.
Overview
ExcelJS reads and writes XLSX spreadsheets from Node.js, covering formatting, formulas, merged cells and streaming for both input and output. It targets the modern Office Open XML format.
Core Methods
Create a Workbook, add Worksheets, then add rows. Reading uses readFile or a stream, and writing uses writeFile, writeBuffer or write to a stream. Cells expose value and style.
Usage Notes
For large exports write to a response stream instead of building the whole workbook in memory. Style headers once and reuse the worksheet columns for widths and formats.
Common Pitfalls
ExcelJS does not calculate formulas, so cells show empty until Excel recalculates. Buffering a huge workbook can exhaust memory, so stream when row counts are high. Styling every cell individually is slow.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:30.791Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Caveat: All the above properties (with the exception of numFmt, which is a string), are JS object structures. (https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md)
- Modified the behaviour to print deprecation warning as tabColor has moved into options.properties. (https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md)
- Merged fix issue #749 Fix internal link example errors in readme #1137 . (https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md)
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:30.791Z.
- Config⬆ ExcelJS now supports dependency injection for the promise library. (https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md)
- Merged Do not escape xml characters when using shared strings #189 . (https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md)
- Merged Decode the _x _ escape notation in shared strings #584 . (https://cdn.jsdelivr.net/gh/exceljs/exceljs@latest/README.md)
FAQ
- How do I read an existing file?
- Use workbook.xlsx.readFile(path) or read a stream, then iterate worksheets and rows. readFile is convenient for local files while streams avoid loading everything into memory.
- Can I apply styles?
- Yes. Rows, columns and cells expose style objects for fonts, fills, borders and number formats. Styling is applied per cell, so set it on ranges rather than individual cells where possible.
- How are formulas handled?
- Set a cell value to an object such as { formula: "SUM(A1:A3)" }. The formula is stored; ExcelJS does not evaluate it, so cached results come from Excel when the file is reopened.
Report a problem with this API docOpens a pre-filled issue on GitHub.