🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

simple-xlsx-reader

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-xlsx-reader

A utility to read xlsx files through NodeJS Stream.

2.0.1
latest
Source
npm
Version published
Weekly downloads
16
433.33%
Maintainers
1
Weekly downloads
 
Created
Source

simple-xlsx-reader

A utility to read xlsx files through NodeJS Stream.

Build Status

Instalation

npm i simple-xlsx-reader --save

Usage

const { Writable } = require('stream')
const fs = require('fs')
const { xlsxParser } = require('simple-xlsx-reader')

const write = (fn) => {
  return new Writable({
    objectMode: true,
    write (chunk, _, callback) {
      fn(chunk)
      callback()
    }
  })
}

fs.createReadStream('path to xlsx file'))
  .pipe(xlsxParser())
  .pipe(write((row) => {
    console.log('XLSX Row', row)
  }))

To return in array of arrays format, you can use onlyCellValues function that get only values of cells.

const { Writable } = require('stream')
const fs = require('fs')
const { xlsxParser, onlyCellValues } = require('simple-xlsx-reader')

const write = (fn) => {
  return new Writable({
    objectMode: true,
    write (chunk, _, callback) {
      fn(chunk)
      callback()
    }
  })
}

fs.createReadStream('path to xlsx file'))
  .pipe(xlsxParser(onlyCellValues()))
  .pipe(write((row) => {
    console.log('XLSX Row', row)
  }))

Keywords

stream

FAQs

Package last updated on 16 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts