xlsxtream

2.0.0 • Public • Published

workflow Jest coverage

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 contents 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 module is presumed to transform .xlsx data 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 the reference below).

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)`)
}
*/

See the project's wiki docs for more information.

Readme

Keywords

none

Package Sidebar

Install

npm i xlsxtream

Weekly Downloads

375

Version

2.0.0

License

ISC

Unpacked Size

128 kB

Total Files

27

Last publish

Collaborators

  • do-