@ayocore/exceljs

中文文档
5.0.4发布于 2026/03/29MITTypeScriptCommonJS近 30 天下载 1万

Lightweight Node.js-only fork of ExcelJS for server-side XLSX generation.

原始使用文档
文档目录16 节
  1. What is this?
  2. What changed from upstream exceljs?
  3. Removed
  4. Upgraded
  5. Security
  6. Lighter
  7. Runtime dependencies
  8. Requirements
  9. Installation
  10. Quick start
  11. Streaming
  12. API
  13. Ported upstream fixes
  14. Bug fixes
  15. Improvements
  16. License

@ayocore/exceljs

Lightweight Node.js-only fork of exceljs for server-side XLSX report generation.

What is this?

A stripped-down, security-hardened fork of ExcelJS optimized for backend use. Read, manipulate and write XLSX spreadsheets on Node.js 20+.

What changed from upstream exceljs?

Removed

  • Browser support -- no browser bundles, no polyfills, no UMD wrappers
  • CSV support -- workbook.csv removed entirely (fast-csv dependency gone)
  • Build step -- no Grunt, no Babel, no Browserify, no esbuild, no terser. Code runs as-is on Node 20+
  • readable-stream polyfill -- replaced with native require('stream')
  • dayjs -- was unused, removed
  • core-js, regenerator-runtime -- not needed on modern Node.js

Upgraded

  • archiver 5 -> 7 -- removed deprecated glob@7 and inflight from transitive deps
  • unzipper 0.10 -> 0.12 -- removed deprecated fstream and rimraf@2 from transitive deps
  • Streaming reader fix -- fixed shared strings race condition when worksheet entries arrive before shared strings in the zip (fixes issue #1328)

Security

Metricupstream exceljs 4.4.0@ayocore/exceljs 5.0.2
npm audit total483 (mocha dev-only)
Critical30
High292 (dev-only)
Runtime vulns10

Lighter

Metricupstream exceljs 4.4.0@ayocore/exceljs 5.0.2
Runtime dependencies96
Package size~2.5 MB~1 MB
node_modules tree1320 packages~600 packages

Runtime dependencies

archiver, jszip, saxes, tmp, unzipper, uuid

Requirements

  • Node.js >= 20
  • Server-side only. Not for browser use.

Installation

npm install @ayocore/exceljs

Quick start

const ExcelJS = require('@ayocore/exceljs');

// Create a workbook
const wb = new ExcelJS.Workbook();
wb.creator = 'My Server';

// Add a worksheet
const ws = wb.addWorksheet('Report');

ws.columns = [
  {header: 'ID', key: 'id', width: 8},
  {header: 'Name', key: 'name', width: 25},
  {header: 'Amount', key: 'amount', width: 15},
];

ws.getRow(1).font = {bold: true};

ws.addRow({id: 1, name: 'Item A', amount: 100});
ws.addRow({id: 2, name: 'Item B', amount: 250});

ws.getColumn('amount').numFmt = '$#,##0.00';

// Write to file
await wb.xlsx.writeFile('/tmp/report.xlsx');

// Or write to buffer
const buffer = await wb.xlsx.writeBuffer();

Streaming

const ExcelJS = require('@ayocore/exceljs');

// Streaming writer (low memory)
const wb = new ExcelJS.stream.xlsx.WorkbookWriter({
  filename: '/tmp/large-report.xlsx',
});

const ws = wb.addWorksheet('Data');
ws.columns = [{header: 'Row', key: 'row'}];

for (let i = 0; i < 1_000_000; i++) {
  ws.addRow({row: i}).commit();
}

ws.commit();
await wb.commit();

API

The API is the same as exceljs with the following exceptions:

  • workbook.csv -- removed (use a dedicated CSV library if needed)
  • Browser-specific features -- removed
  • ES5/dist builds -- removed

For full API documentation, see the upstream docs.

Ported upstream fixes

This fork includes bug fixes and improvements from open PRs in the original exceljs repository that have not yet been merged upstream.

Bug fixes

PRDescriptionAuthor
#2915Fix WorkbookReader race condition — cell values read as sharedString index instead of actual value@AnechaS
#2807Fix pageSetUpPr/outlinePr ordering in sheetPr — broken xlsx output@strelok372
#2851Fix boolean attribute parsing — <strike val="0"/> was read as true@Jason33Wang
#2803Fix corrupted file when combining conditional formatting with hyperlinks in stream writer@TheAsda
#2956Fix dateToExcel() returning NaN for non-numeric values@davepuchyr
#2737Don't render empty rich text substrings — Excel can't open the file@Blackhol3
#2781Fix cell style mutation — setting style on one cell no longer corrupts others sharing the same style object@gmahomarf
#2973Fix crash when parsing Excel tables with dynamicFilter nodes@johnnyoshika
#2996Fix XML special characters and null values in pivot tables@protobi-pieter
#2962Handle missing r attribute in row/cell elements — improves compatibility with non-standard Excel generators@Diluka
#2920Optimize merge cell overlap check — O(N) scan replaced with per-cell isMerged check@3ximus
#2894Fix SAX parser breaking multi-byte UTF-8 characters (Chinese, emoji, etc.) across chunk boundaries@maoxian-1
#2874Fix race conditions and memory leaks in stream iteration@StevenGee3398

Improvements

PRDescriptionAuthor
#2867Style cache modes (FAST_MAP, JSON_MAP) — up to 3x write performance with useStyles@brunoargolo
#2998Fix getTable().addRow() for tables loaded from files — refs, autoFilter, and worksheet binding@protobi-pieter
#2995Support multiple pivot tables per workbook + fix .splice() data mutation bug@protobi-pieter

Thank you to all the original authors for their contributions to the exceljs ecosystem.

License

MIT -- original work by Guyon Roche and exceljs contributors.

版本与发布记录

@ayocore/exceljs 共发布 5 个版本,首次发布于 2026/03/28;过去 12 个月发布了 5 个版本。

版本发布日期距今
5.0.4latest2026/03/297 个月前
5.0.32026/03/287 个月前
5.0.22026/03/287 个月前
5.0.12026/03/287 个月前
5.0.02026/03/287 个月前

关于 @ayocore/exceljs 的常见问题

@ayocore/exceljs 是什么?

Lightweight Node.js-only fork of ExcelJS for server-side XLSX generation.

如何安装 @ayocore/exceljs?

在项目目录运行 npm install @ayocore/exceljs,或使用 pnpm add / yarn add / bun add。

@ayocore/exceljs 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ayocore/exceljs 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@ayocore/exceljs 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ayocore/exceljs 可以商用吗?

@ayocore/exceljs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ayocore/exceljs 的下载量有多少?

根据 npm 官方下载统计,@ayocore/exceljs 在 2026/10/08 – 2026/11/06 这 30 天内被下载 10,048 次,日均约 335 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ayocore/exceljs 还在维护吗?

最新版本 5.0.4 发布于 2026/03/29(7 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/03/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。