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

extract-xlsx

v1.0.4

Published

A lightweight XLSX parser alternative to xlsx NPM package

Downloads

31

Readme

📦 extract-xlsx

A lightweight, zero-dependency .xlsx (Excel) file parser written in TypeScript, built as an alternative to heavier libraries like xlsx.

It reads Excel .xlsx files directly by parsing XML and returns data in structured JSON format.


✨ Features

  • ✅ Reads .xlsx files (Office Open XML format)
  • ✅ Dynamically detects sheets via workbook.xml
  • ✅ Reads any sheet by name or defaults to the first sheet
  • ✅ Parses shared strings, headers, and rows
  • ✅ Works in Node.js (browser support planned)
  • ✅ Minimal and blazing fast

📦 Installation

npm install extract-xlsx

or

yarn add extract-xlsx

🚀 Usage ✅ Read from file

import { readXlsxFromFile } from "extract-xlsx";

// Reads the first sheet by default
const data = await readXlsxFromFile("path/to/file.xlsx");

console.log(data);
// Output: [ { Name: "Alice", Age: "30" }, { Name: "Bob", Age: "25" } ]

✅ Read specific sheet

const data = await readXlsxFromFile("path/to/file.xlsx", "Employees");

✅ Read from buffer (custom use)

import { parseXlsx } from "extract-xlsx";
import fs from "fs";

const buffer = fs.readFileSync("sample.xlsx");
const result = await parseXlsx(buffer, "Sheet1");

✅ Sample Usage in Browser (React or Vanilla JS)

React JS

import { parseXlsx, getSheetNames } from "extract-xlsx";
import { Buffer } from "buffer"; // Need to be installed // npm install buffer
(window as any).Buffer = Buffer; // declare after installed

const Home = () => {
  const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
    const file = e.target.files?.[0];
    if (!file) return;
    const arrayBuffer = await file.arrayBuffer();
    const buffer = Buffer.from(arrayBuffer); // If you're using `buffer` polyfill in browser

    const sheetNames = await getSheetNames(buffer);
    console.log("Sheets:", sheetNames);

    const data = await parseXlsx(buffer, sheetNames[0]);
    console.log("Data:", data);
  };

  return (
    <div>
      {" "}
      <input
        id="upload"
        type="file"
        accept=".xlsx"
        onChange="{handleFileChange}"
        className="mb-4"
      />
    </div>
  );
};

export default Home;
import { parseXlsx, getSheetNames } from "extract-xlsx";
import { Buffer } from "buffer"; // Need to be installed // npm install buffer
(window as any).Buffer = Buffer; // declare after installed

document
  .querySelector("#upload")
  ?.addEventListener("change", async (e: any) => {
    const file = e.target.files[0];
    const arrayBuffer = await file.arrayBuffer();
    const buffer = Buffer.from(arrayBuffer); // If you're using `buffer` polyfill in browser

    const sheetNames = await getSheetNames(buffer);
    console.log("Sheets:", sheetNames);

    const data = await parseXlsx(buffer, sheetNames[0]);
    console.log("Data:", data);
  });

🧪 Output Format

An array of JSON objects using the first row as headers:

[
  { Name: "Alice", Age: "30" },
  { Name: "Bob", Age: "25" },
];

📄 API


readXlsxFromFile(filePath: string, sheetName?: string): Promise<any[]>
Reads from local file

sheetName (optional) — defaults to first sheet

parseXlsx(buffer: Buffer, sheetName?: string): Promise<any[]>
Accepts file Buffer

Parses .xlsx format into JSON

🔒 Limitations

Only supports .xlsx files (not .xls)

Formula and styling not supported

Returns plain data only

📚 Roadmap

Multi-sheet parser

.xls (legacy) format support

Write/Export .xlsx (optional)

🧑‍💻 Author

Created by [RAJASEKAR E C [email protected]] GitHub: rajasekar-arch