Skip to content
Log in

Overview

Edit, recalculate and render .xlsx workbooks in Node and the browser, without Microsoft Excel, LibreOffice or a server.

What you can do

  • Edit a workbook with a JS API. ExcelWorkbook is Office.js-like: it follows the names in the Office JavaScript API for worksheets, ranges, formats, tables and charts. See Concepts.
  • Calculate formulas. The formula engine recalculates what an edit changes. Read a cell and you get the new value. See Recalculation.
  • Export PDF or PNG. One page or one image for each sheet, or one range. PDF is in Node only. A PNG of a range works in the browser too. See PDF and PNG.
  • Show a workbook in a page. A canvas grid with charts, pictures and the sheet tabs. See View.
  • Add a spreadsheet editor to your app. @reductoai/xlsx-editor gives the Home tab, the editable grid, and windows and menus that work like those in Microsoft Excel, in one mount call. See Editor.

Open and save are lossless: parts the library does not change are written back as they were read, and only edited sheets are rewritten.

Example

import { ExcelWorkbook } from "@reductoai/xlsx/node";

const book = await ExcelWorkbook.open("model.xlsx");
const sheet = book.worksheets.getItem("Sheet1");
sheet.getRange("A1:B2").values = [
  [1, 2],
  [3, 4],
];
sheet.getRange("C1").formulas = [["=SUM(A1:B2)"]];
sheet.getRange("A1:C1").format.font.bold = true;
console.log(sheet.getRange("C1").values); // [[10]]
await book.save("model.edited.xlsx");
await book.toPdf("model.pdf");

Packages

Package What it is
@reductoai/xlsx The workbook model, formula engine, JS API, canvas grid and headless editor
@reductoai/xlsx-editor The spreadsheet editor UI for the browser, with a React wrapper
@reductoai/portable-fonts Open fonts with Office font metrics; used to measure and paint text

Entry points

Import Use it for
@reductoai/xlsx Workbook and Worksheet: cell values and formulas by row and column, and the formula engine (calc)
@reductoai/xlsx/officejs ExcelWorkbook, the JS API. Works in Node and in the browser
@reductoai/xlsx/node ExcelWorkbook with file paths: open, save, toPdf, toPng
@reductoai/xlsx/view The canvas grid, charts and previewWorkbook (browser)
@reductoai/xlsx/editor XlsxEditor, the headless editor: Home-tab commands, undo and the context menu
@reductoai/xlsx/blank blankWorkbookBytes(): the bytes of an empty workbook

Not supported

  • 3D references (Sheet1:Sheet3!A1)
  • Add-in functions and external references keep their cached values
  • FORECAST.ETS and its forms
  • Functions that need a server: CUBE*, WEBSERVICE, STOCKHISTORY, RTD, IMAGE and TRANSLATE give #NAME?
  • Pivot refresh with ungrouped dates or calculated fields
  • Flash Fill, and Paste Special other than Paste Values

Type to search…

escClose