Skip to content
do- edited this page Aug 27, 2023 · 17 revisions

xlsxtream is a module for reading tabulated data from .xlsx (and, in general, OOXML) workbooks using node.js streams API.

Only common workbook data (including the shared strings list) are kept in memory; worksheets content is read row by row using a chain of transform streams.

Basically, rows read are Arrays of Strings. Dates are presented in YYYY-MM-DD format, time in HH:MI:SS. No effort is made to properly map scalar values to javaScript objects as the presumed module's purpose is to transform .xlsx into CSV and other text formats for further bulk load into databases and similar operations.

Advanced users may prefer to alter the output format by accessing some lower level internals (see API reference).

Installation

npm install xlsxtream

Usage

const xlsx = require ('xlsxtream')

const workbook = xlsx.open ('/path/to/book.xlsx')

const worksheet = workbook.sheetByName.Sheet1
// const worksheet = workbook.sheets [0]
// worksheet.toObject = function (xmlNode) {return ...}

const rows = await ws.getObjectStream ()
/*
for await (const [A, B, C] of rows) {
  console.log (`A=${A}, B=${B}, C=${C}`)
  console.log (` (read ${worksheet.position} of ${worksheet.size} bytes)`)
}
*/

For more information, consult the API reference:

Clone this wiki locally