Socket
Book a DemoInstallSign in
Socket

sheet-to-array-browser

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sheet-to-array-browser

converts sheet data to javascript array

latest
Source
npmnpm
Version
2.3.0
Version published
Weekly downloads
210
-38.24%
Maintainers
1
Weekly downloads
 
Created
Source

sheet-to-array-browser

Convert Excel/Sheet files (.xlsx, .xls) into JavaScript arrays with ease.
Works in both browsers (via <input type="file"> or drag-drop) and Node.js.

✨ Features

  • ✅ Parse .xlsx and .xls files into JSON/arrays
  • ✅ Works in browsers and Node.js
  • ✅ Supports selecting a specific worksheet (by index or name)
  • ✅ Built on SheetJS/xlsx
  • ✅ Lightweight, tree-shakeable, TypeScript-ready

📦 Installation

npm i sheet-to-array-browser

🚀 Usage

Browser (with file input)

import { parseWorkbook } from "sheet-to-array-browser";

document.getElementById("fileInput").addEventListener("change", async (e) => {
  const file = e.target.files[0];
  const rows = await parseWorkbook(file, { sheet: 0 });
  console.log(rows);
});

Node.js (with Buffer/ArrayBuffer)

import { readFileSync } from "fs";
import { parseWorkbook } from "sheet-to-array-browser";

const buffer = readFileSync("./example.xlsx");
const rows = await parseWorkbook(buffer, { sheet: "Data" });

console.log(rows);

📖 API

parseWorkbook(input, options?)

  • input

    File | Blob | ArrayBuffer | Buffer

    (Works with browser files, Node Buffers, or raw ArrayBuffers)

  • options (optional)

    • sheet (number | string) → Which sheet to read

    • index (0 = first sheet)

    • or sheet name ("Data")

    • default: 0

  • sheetToJson (XLSX.Sheet2JSONOpts) → Options passed to XLSX.utils.sheet_to_json

  • Returns

    Promise<Array<object>> → An array of row objects.

🛠 Development

Clone the repo and run:

npm install
npm run build
npm test

npm run build → Build dist files

npm test → Run unit tests (Vitest)

npm run pack:check → Preview files that will publish

Keywords

sheet

FAQs

Package last updated on 31 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.