New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xlsx-to-json

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xlsx-to-json - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

sample/tags_test.json

15

libs/index.js

@@ -14,3 +14,3 @@ var fs = require('fs');

var cv = new CV(config, callback);
}

@@ -20,3 +20,3 @@

var wb = this.load_xlsx(config.input)
var ws = this.ws(wb);
var ws = this.ws(config, wb);
var csv = this.csv(ws)

@@ -30,7 +30,8 @@ this.cvjson(csv, config.output, callback)

CV.prototype.ws = function(wb) {
var target_sheet = '';
CV.prototype.ws = function(config, wb) {
var target_sheet = config.sheet;
if(target_sheet === '')
if (target_sheet == null)
target_sheet = wb.SheetNames[0];
ws = wb.Sheets[target_sheet];

@@ -55,3 +56,3 @@ return ws;

.on('record', function(row, index){
if(index === 0) {

@@ -77,3 +78,3 @@ header = row;

}
})

@@ -80,0 +81,0 @@ .on('error', function(error){

{
"name": "xlsx-to-json",
"version": "0.2.3",
"version": "0.2.4",
"description": "Convert xlsx to json",

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

@@ -29,2 +29,21 @@ # node-xlsx-json

### Specifying a target sheet
You can optionally provide a sheet name to extract from that sheet
```javascript
xlsxj = require("xlsx-to-json");
xlsxj({
input: "sample.xlsx",
output: "output.json",
sheet: "tags"
}, function(err, result) {
if(err) {
console.error(err);
}else {
console.log(result);
}
});
```
In config object, you have to enter an input path. But If you don't want to output any file you can set to `null`.

@@ -31,0 +50,0 @@

@@ -24,2 +24,3 @@ var should = require('should');

result.should.be.an.instanceOf(Object)
result[0].name.should.be.exactly('start')
})

@@ -33,4 +34,20 @@

})
it('should access config specified sheet', function() {
xlsx2json({
input: './sample/interview.xlsx',
output: './sample/tags_test.json',
sheet: 'tags'
}, function(err, result) {
should.not.exist(err)
result.should.be.an.instanceOf(Object)
result[0].group.should.be.exactly('default')
})
})
it('should exist test.json', function() {
var exist = fs.existsSync('./sample/tags_test.json')
exist.should.be.true;
})
})
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