Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 27, 2026·3 min de lecture

SheetJS — Read and Write Spreadsheets from JavaScript

A comprehensive JavaScript library for parsing and writing Excel, CSV, and other spreadsheet formats in the browser and Node.js.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
SheetJS Overview
Commande d'installation directe
npx -y tokrepo@latest install 2c6f3366-5961-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

SheetJS (also published as the xlsx npm package) provides a pure-JavaScript engine for reading, editing, and writing spreadsheet data. It handles dozens of file formats—XLS, XLSX, CSV, ODS, and more—without native dependencies, making it suitable for both server-side Node.js scripts and in-browser applications.

What SheetJS Does

  • Parses Excel files (XLS, XLSX, XLSB) into a uniform workbook object model
  • Writes workbooks back to XLSX, CSV, HTML, JSON, and other output formats
  • Runs in the browser with no server round-trips, enabling client-side export
  • Converts between row-major arrays, JSON arrays, and HTML tables
  • Handles multi-sheet workbooks, merged cells, number formats, and date parsing

Architecture Overview

SheetJS exposes a workbook/sheet data model. File bytes are fed to a format-specific parser that produces a workbook object containing named sheets. Each sheet is a sparse two-dimensional map of cell objects keyed by A1-style references. Utility functions convert between this internal representation and developer-friendly structures like arrays of objects. Writers serialize the workbook back into the target binary or text format.

Setup & Configuration

  • Install from npm: npm install xlsx or load via CDN for browser use
  • Import with require('xlsx') (CJS) or import * as XLSX from 'xlsx' (ESM)
  • No native add-ons or external binaries required
  • Use the streaming API (XLSX.stream) for large files that exceed memory limits
  • Configure date handling with cellDates: true in the parsing options

Key Features

  • Supports 20+ spreadsheet formats including legacy XLS and modern XLSB
  • Zero native dependencies—runs identically in Node.js, Deno, and browsers
  • Streaming reader and writer for processing large files efficiently
  • Rich cell metadata including types, styles, formulas, and comments
  • Active maintenance with frequent releases since 2012

Comparison with Similar Tools

  • ExcelJS — provides deeper style and image support but only handles XLSX; SheetJS covers far more formats
  • Papa Parse — CSV-only parser; SheetJS handles CSV plus binary Excel and ODS
  • openpyxl (Python) — Python equivalent for XLSX; SheetJS brings the same capability to JavaScript
  • Tabulator — focuses on UI table rendering; SheetJS focuses on file I/O

FAQ

Q: Can SheetJS run in the browser without a server? A: Yes. It parses files entirely in the browser using the File API or drag-and-drop input.

Q: Does SheetJS support writing styled XLSX files? A: The community edition handles data and basic number formats. The Pro edition adds full styling, images, and pivot tables.

Q: How does SheetJS handle large files? A: Use the streaming API to process rows incrementally rather than loading the entire workbook into memory.

Q: Is SheetJS free and open source? A: The core library is released under the Apache-2.0 license. An optional Pro tier adds advanced features.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires