Socket
Socket
Sign inDemoInstall

simple-xlsx-reader

Package Overview
Dependencies
55
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    simple-xlsx-reader

A utility to read xlsx files through NodeJS Stream.


Version published
Weekly downloads
15
increased by7.14%
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 16 Oct 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc