Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "simple-xlsx-reader",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -18,3 +18,3 @@

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

@@ -32,6 +32,30 @@ const write = (fn) => {

fs.createReadStream('path to xlsx file'))
.pipe(xmlParser())
.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.
```javascript
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)
}))
```

@@ -234,7 +234,7 @@ const unzipper = require('unzipper');

const asArray = (opts = {}) => Object.assign({ mapCol: (col) => col.value }, opts || {})
const onlyCellValues = (opts = {}) => Object.assign({ mapCol: (col) => col.value }, opts || {})
module.exports = {
xlsxParser,
asArray
onlyCellValues
}
/* eslint-disable no-undef */
const { xlsxParser, asArray } = require('../src/')
const { xlsxParser, onlyCellValues } = require('../src/')
const expect = require('chai').expect

@@ -26,3 +26,3 @@ const fs = require('fs')

fs.createReadStream(path.resolve(__dirname, './assets/sample1.xlsx'))
.pipe(xlsxParser(asArray()))
.pipe(xlsxParser(onlyCellValues()))
.pipe(write((chunk) => {

@@ -29,0 +29,0 @@ expect(chunk).to.be.a('array').that.is.not.empty

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc