Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@shbernal/ts-xlsx

Latest version: v4.0.1-next.67.gbaa4b49

Overview

Last scanned
24 Nov 2026
Published
24 Nov 2026
npm package Publisher: shbernal
2 Stars
2 Forks
50 Versions
5.9K Downloads
TypeScript Repo language

Scan summary

@shbernal/ts-xlsx was last scanned on 24 Nov 2026 at version 4.0.1-next.67.gbaa4b49. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 50 versions; the latest 5 were published within 5 days (20–24 Nov 2026).
  • Findings: No rules fired in version 4.0.1-next.67.gbaa4b49.
  • Downloads: 5,903 downloads.

Versions

50 versions published
Versions and the rules that fired in each
VersionPublishedStatus
4.0.1-next.67.gbaa4b49 LATEST 24 Nov 2026 No rules fired
4.0.1-next.66.g7d6c9a3 23 Nov 2026 No rules fired
4.0.1-next.65.g0565eec 23 Nov 2026 No rules fired
4.0.1-next.64.g7c96724 23 Nov 2026 Not shown
4.0.1-next.63.gf156730 20 Nov 2026 Not shown

No rules fired in 4.0.1-next.67.gbaa4b49

Findings

Findings for v4.0.1-next.67.gbaa4b49. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 4.0.1-next.67.gbaa4b49; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

ts-xlsx

npm weekly downloads total downloads CI License: MIT

A TypeScript-first library for reading and writing spreadsheet documents (.xlsx / OOXML, and CSV). It is synchronous, Uint8Array-native, and dependency-lean.

Documentation, guide and a browser playground

Status: stable and published on npm. The changelog has the current version. ts-xlsx began as a hard fork of ExcelJS and has been rebuilt from the ground up into a modern, strict-TypeScript library. It carries no backwards-compatibility guarantee with ExcelJS: the API below is its own, not a drop-in. From 1.0.0 onward it follows SemVer against itself; see the changelog. See AGENTS.md for the goals and docs/architecture.md for the design, and migrating from ExcelJS if you are coming across.

Why it exists

Upstream ExcelJS is effectively unmaintained (no release since 2023, a backlog of hundreds of issues and PRs), while still serving tens of millions of downloads a month. ts-xlsx extracts the accumulated value from that backlog (as a permanent regression corpus) and discards the debt: no untyped APIs, no callback APIs, a single small runtime dependency, and every behavior pinned by a test. This is not a compatibility shim. It is a different, better library that happens to share ancestry.

What that buys you today:

  • Strict, precise types are the contract. strict + noUncheckedIndexedAccess + exactOptionalPropertyTypes. The published .d.ts is the documentation, and the API reference is generated straight from it.
  • Synchronous, buffer-native I/O. readXlsx/writeXlsx take and return a Uint8Array. There are no streams to await for the buffered path, no Node Buffer assumption, so the same code runs in Node and the browser.
  • Streaming when you need it. Bounded-memory row streaming on the read side: read a large workbook without materializing it. On the write side, author one incrementally: each committed row is written into the sheet's part in the archive and leaves memory, at the pace your sink accepts, so memory depends on the rows you have not committed yet, not on the sheet's length. Rows go out in order, so the writer refuses an edit to a row it has already written (streaming guide).
  • One runtime dependency (fflate for zip), a hand-written SAX reader with bounded allocation on every parser path, and a build-free, strict-typed source tree.

Install

npm install @shbernal/ts-xlsx

Requires Node ≥ 24 (or any modern browser bundler). ESM only.

Quick start

The buffered path is synchronous. writeXlsx returns the file bytes; readXlsx takes them back.

import {Workbook, writeXlsx, readXlsx} from '@shbernal/ts-xlsx';

// --- write ---
const wb = new Workbook();
const sheet = wb.addWorksheet('People');

sheet.getCell('A1').value = 'Name';
sheet.getCell('B1').value = 'Joined';
sheet.addRow(['Ada', new Date('2026-01-01')]);
sheet.addRow(['Grace', new Date('2026-02-14')]);
sheet.getCell('C1').value = {formula: 'COUNTA(A:A)', result: 3};

const bytes: Uint8Array = writeXlsx(wb);

// --- read it back ---
const reopened = readXlsx(bytes);
const people = reopened.getWorksheet('People');
console.log(people?.getCell('A2').value); // 'Ada'

Persisting to disk is your platform's job, not the library's. writeXlsx hands you the bytes:

import {writeFileSync, readFileSync} from 'node:fs';

writeFileSync('people.xlsx', writeXlsx(wb));
const wb2 = readXlsx(readFileSync('people.xlsx')); // a Buffer is a Uint8Array

Core model

  • Workbook: the document. addWorksheet(name), getWorksheet(nameOrId), worksheets, defined names, images, and workbook-level properties.
  • Worksheet: a sheet. getCell('B3'), addRow(values), addTable(...), mergeCells('A1:B2'), getRow(n) / getColumn(n), rows() / columns(), page setup, and print options.
  • Row / Column: one line of the grid. Formatting is flat (row.height = 20, column.width = 12, column.key = 'name'), and cells are reachable from it: row.getCell('B'), row.cells, row.values.
  • Cell: one cell. cell.value is the whole story: a number, string, boolean, Date, null (empty), a formula ({formula, result}), rich text, or an error, all precisely typed as CellValue. A hyperlink is not a value: it sits on the sheet, over any cell, through sheet.addHyperlink({ref: 'B2', target: 'https://example.com'}).
sheet.getRow(1).height = 20;
sheet.getRow(1).values = ['Name', 'Joined'];
sheet.getColumn(1).width = 24;
sheet.getRow(2).getCell('B').value = new Date('2026-01-01');

for (const row of sheet.rows()) {
  console.log(row.number, row.values);
}

Row and Column are handles, not snapshots: they read and write straight through to the sheet, so two handles on the same line always agree, and reading one creates nothing. Asking about row 500 costs nothing and does not extend the used range. Position is fixed, exactly as a Cell's is: after a splice, getRow(3) still means row 3, now holding whatever moved there.

Addresses are honest: an axis a reference doesn't mention is undefined, never a sentinel. See decodeAddress.

Charts, vector shapes, slicers, and legacy form controls are round-trip-only: a workbook that has them keeps them byte-faithfully through a load/edit/save, but there is no API to author a new one. See docs/api/preserved.md and ADR-0014.

Reading, writing, streaming, CSV

import {
  readXlsx,
  writeXlsx, // buffered .xlsx  (Uint8Array ⇄ Workbook)
  readSheetRows, // stream one sheet's rows, bounded memory
  readWorkbookStream, // stream every sheet, rows one at a time
  readCsv,
  writeCsv, // CSV as Uint8Array
  writeCsvText, // CSV as a string
} from '@shbernal/ts-xlsx';
// The streaming writer opens files and pipes Node streams, so it is the one Node-only face
// and lives behind its own subpath. That keeps everything above browser-safe:
import {WorkbookStreamWriter} from '@shbernal/ts-xlsx/node';

// Bounded-memory extraction. The whole workbook is never materialized:
for (const row of readSheetRows(bytes, {sheet: 'People'})) {
  console.log(
    row.number,
    row.cells.map((c) => c.value),
  );
}

// Incremental generation. Each committed row is written out and freed; awaiting the commit
// lets a slow sink set the pace:
const writer = new WorkbookStreamWriter({filename: 'big.xlsx'});
const out = writer.addWorksheet('Big');
for (let i = 1; i <= 1_000_000; i++) await out.addRow([i, i * i]).commit();
await out.commit();
await writer.commit(); // undefined: the package went to the file, never held whole

The streaming writer is asynchronous where the buffered path is synchronous. Give it a sink ({stream}, such as an HTTP response, or {filename}) and the rows reach it while you commit them; commit() on the writer then resolves with undefined, because the archive was never held as one object. With no sink, commit() resolves with the package bytes and writer.stream (a Node Readable) carries the same bytes, but both keep the whole archive in memory.

Writing without blocking the event loop

writeXlsx spends the whole cost of DEFLATE on the calling thread: seconds, for a large workbook, during which a server answers nothing. writeXlsxAsync produces the same package with the compression handed to worker threads:

import {writeXlsxAsync} from '@shbernal/ts-xlsx';

const bytes = await writeXlsxAsync(wb); // same package, event loop stays live

Measured on a ~42 MB part map: one large sheet takes the same wall-clock either way, but the longest event-loop stall drops from the entire write to ~17 ms; a twenty-sheet workbook also finishes about 2.4× sooner, because its parts deflate in parallel. Expect responsiveness always and speed only when there is more than one substantial part.

There is deliberately no readXlsxAsync. Reading is dominated by XML parsing and model building, which no worker can take off the calling thread, so it would advertise a non-blocking read and then block for most of its duration. The reader also enforces its zip-bomb ceiling by counting output between synchronous input slices, a guarantee that weakens the moment inflation moves to a worker. If you need a non-blocking read, run the whole read in a worker. See ADR-0024.

The reader decodes untrusted input defensively. Entities are decoded but never expanded, and inflation is bounded by a running output counter rather than any declared size, so a malformed or hostile package can't exhaust memory.

Entry points

The bare package name gives you everything, and with a bundler that is the right default: "sideEffects": false is declared, so anything you don't reference is dropped. The subpaths are for when you'd rather the module graph itself said which half of the library you depend on, as in a Lambda with no bundler or a service that only classifies failures:

Import from You get It loads
@shbernal/ts-xlsx everything except the streaming writer 501 KB
@shbernal/ts-xlsx/core Workbook, Worksheet, Cell, styles, values, addresses 185 KB
@shbernal/ts-xlsx/xlsx readXlsx, writeXlsx/writeXlsxAsync, the streaming reader, VBA part edits 490 KB
@shbernal/ts-xlsx/xlsb readXlsb 256 KB
@shbernal/ts-xlsx/csv readCsv, writeCsv, writeCsvText 191 KB
@shbernal/ts-xlsx/node WorkbookStreamWriter and the rest of the streaming writer 358 KB
@shbernal/ts-xlsx/vba parseVbaProject, addVbaReference, removeVbaModule 46 KB
@shbernal/ts-xlsx/customui parseCustomUi and the ribbon types 15 KB
@shbernal/ts-xlsx/errors every error class the library throws 3 KB

/node is the only one the root specifier does not carry, and the reason is its imports rather than its size: it reaches node:fs and node:stream, and every other entry reaches no Node built-in at all, which is what makes them bundle for a browser with nothing to configure (ADR-0040).

Every error class lives in /errors and nowhere else, because a container-level failure belongs to no single codec: readXlsx and readXlsb both raise UnsupportedFormatError. Catching and classifying therefore costs 3 KB, not a parser.

/xlsx is barely cheaper than the whole package, and that is honest rather than a defect: readXlsx sniffs the bytes and hands a binary package to the BIFF12 reader, so the .xlsb codec is not optional on that path. The numbers above are the static-import closure of each entry, measured by pnpm run size. A bundler can only shrink them further.

API reference

The full reference is generated from the public types, so it cannot drift from what the compiler accepts. It lives in docs/api/. Regenerate it with:

pnpm run docs

Coming from ExcelJS?

Read migrating from ExcelJS. The short version: the shapes are deliberately different (synchronous Uint8Array I/O instead of async Buffer/stream methods, readXlsx/writeXlsx free functions instead of workbook.xlsx.*), because the goal was the right API, not the familiar one.

Hit a bug? There is a skill for that

Most code that uses this library is written by an agent, and an agent that hits a library defect will usually route around it silently, so the defect is never reported and never fixed. ts-xlsx-upstream is a skill that turns that moment into a filed issue with a minimal reproduction, which is what the maintainers convert into a permanent regression test. It ships inside the package, so it is already on disk:

npx skills add ./node_modules/@shbernal/ts-xlsx     # offline, matches your installed version
npx skills add shbernal/ts-xlsx                     # or straight from the repo

That writes the skill under .agents/skills/, links it into whichever agent directories it finds, and records what it did in skills-lock.json. Track the lock file and ignore the copies: they are derived, npx skills experimental_install rebuilds them from the lock, and npx skills update overwrites them in place.

It covers triage (is this bug ours or your file's?), reducing a failure to a script that builds its own input, and never uploading a workbook to a public tracker, because spreadsheets carry real data. Once the reproduction stands on its own, it files without interrupting you, and tells you the issue number afterwards.

You do not need it to report something: https://github.com/shbernal/ts-xlsx/issues is open, and errors the library knows are its own fault print that link themselves.

Design principles

This project is optimized to be built and maintained largely by autonomous agents, with a machine-checkable safety net as the primary guarantor of correctness. The rules that govern every change are in AGENTS.md; the design and working agreements are in docs/architecture.md; notable decisions are recorded under docs/decisions/.

License

MIT, inherited from ExcelJS and retained.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @shbernal/ts-xlsx

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Frame 2085668439 (1)
Group 1261154229