npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@office-open/xlsx

v0.8.1

Published

Generate, parse, and patch .xlsx spreadsheets with a declarative TypeScript API

Readme

@office-open/xlsx

npm version npm downloads npm license

Generate and parse .xlsx spreadsheets with a declarative TypeScript API. Works in Node.js and browsers.

Features

  • 📗 Workbook Generation — Create spreadsheets with multiple worksheets
  • 📊 Cell Data — Strings, numbers, booleans, dates, and inline strings
  • 🎨 Styles — Fonts, fills, borders, alignment, and number formats via index-based style system
  • 🔀 Merged Cells — Merge cell ranges across rows and columns
  • 📏 Column Width & Row Height — Custom column widths and row heights with hiding support
  • ❄️ Freeze Panes — Freeze rows and/or columns for scrollable headers
  • 🔽 Auto Filter — Add auto-filter dropdowns to column headers
  • 🖼️ Images — Embed PNG and JPEG images anchored to cells
  • 📈 Charts — Bar, line, pie, area, and scatter charts with customization
  • Data Validation — List, whole number, decimal, date, and custom validations
  • 🎯 Conditional Formatting — Cell value-based rules with formatting
  • 📊 Pivot Tables — Create pivot tables with various aggregation functions
  • 💬 Comments — Cell comments with author tracking and rich text support
  • 🔒 Sheet & Workbook Protection — Password-protect worksheets and workbook structure
  • 📖 Parsing — Parse existing .xlsx files with parseWorkbook for round-trip workflows
  • 🔧 Template Patching — Patch existing XLSX templates via placeholder replacement

Installation

# pnpm
pnpm add @office-open/xlsx

# npm
npm install @office-open/xlsx

# yarn
yarn add @office-open/xlsx

# bun
bun add @office-open/xlsx

Quick Start

import { Workbook, Packer } from "@office-open/xlsx";
import { writeFileSync } from "node:fs";

const wb = new Workbook({
  worksheets: [
    {
      name: "Sheet1",
      rows: [
        { cells: [{ value: "Name" }, { value: "Score" }] },
        { cells: [{ value: "Alice" }, { value: 95 }] },
        { cells: [{ value: "Bob" }, { value: 87 }] },
      ],
    },
  ],
});

const buffer = await Packer.toBuffer(wb);
writeFileSync("workbook.xlsx", buffer);

Examples

Check the demo folder for working examples covering every feature.

Benchmark

Performance comparison against hucre (0.6.0) (higher ops/s is better, Windows 11 / Node 24).

Default = XML DEFLATE level 1 (SuperFast, matching MS Office) + media STORE. All STORE = no compression ({ compression: { xml: 0 } }). hucre (async only) uses CompressionStream("deflate-raw") when available, falls back to STORE per-entry when compression doesn't reduce size.

// Default (matches MS Office)
await Packer.toBuffer(wb);
// All STORE (no compression)
await Packer.toBuffer(wb, { compression: { xml: 0 } });

Create + toBuffer (end-to-end)

| Scenario | Default sync | Default async | All STORE sync | All STORE async | hucre | | ---------------- | -----------: | ------------: | -------------: | --------------: | ----------: | | Simple (3 rows) | 3,528 ops/s | 1,266 ops/s | 17,759 ops/s | 17,193 ops/s | 949 ops/s | | Styled rows (20) | 3,403 ops/s | 1,289 ops/s | 16,516 ops/s | 13,811 ops/s | 971 ops/s | | Table (10x5) | 3,449 ops/s | 1,414 ops/s | 16,036 ops/s | 13,475 ops/s | 1,031 ops/s |

Large Files — Create + toBuffer

| Scenario | Default sync | Default async | All STORE sync | All STORE async | hucre | | ----------------------------- | -----------: | ------------: | -------------: | --------------: | ---------: | | 2000 rows + 10 images | 87.5 ops/s | 79.7 ops/s | 101.0 ops/s | 101.2 ops/s | 46.4 ops/s | | 200x10 table | 754 ops/s | 517 ops/s | 1,049 ops/s | 963 ops/s | 226 ops/s | | 20 sheets x 100 rows + 20 img | 60.9 ops/s | 49.9 ops/s | 76.8 ops/s | 77.5 ops/s | 25.3 ops/s |

Large Data — 100,000 rows x 20 columns (2M cells)

| Method | Speed | Speedup | | --------- | ---------: | -------: | | All STORE | 0.74 ops/s | 1.9x | | Default | 0.66 ops/s | 1.7x | | hucre | 0.40 ops/s | |

License