Skip to content

Repository files navigation

tablsx

tablsx is a lightweight ESM Node.js library for reading and writing Excel .xlsx files as predictable JavaScript data. It is written in TypeScript and ships full type definitions.

It is designed for data interchange, imports and exports, and programmatic workbook generation rather than full spreadsheet editing.

Installation

npm install @nap-sft/tablsx

Quick start

import {
  createCell,
  createWorkbook,
  createWorksheet,
  readXlsx,
  writeXlsx,
} from "@nap-sft/tablsx";

const workbook = createWorkbook([
  createWorksheet("People", [
    [createCell("name"), createCell("age")],
    [createCell("Ada"), createCell(36)],
    [createCell("Linus"), createCell(54)],
  ]),
]);

const bytes = writeXlsx(workbook);
const parsed = readXlsx(bytes);

console.log(parsed.sheets[0].rows[1][0].value);
// "Ada"

Core capabilities

  • Read .xlsx workbooks into a normalized JavaScript model
  • Write .xlsx workbooks from normalized workbook objects
  • Convert row objects to worksheets with sheetFromRows
  • Convert worksheets back to row objects with rowsFromSheet
  • Build workbooks fluently with WorkbookBuilder and SheetBuilder
  • Work with strings, numbers, booleans, dates, formulas, empty cells, and numeric vectors

Documentation

Full documentation is available at silverstone-i.github.io/tablsx.

Development

npm test
npm run lint
npm run docs:dev

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages