parse-xlsx
A simple module and CLI for parsing tabular data in an excel worksheet.
The parser assumes that the first line of your table contains column headers:
Usage
npm install -g parse-xlsx
npm run test
npm run demo
npm run cli-demo
The CLI (bin/xlsx2ndj
) takes an excel file as input and generates newline-delimited JSON as output:
xlsx2ndj --sheet=Transcript sample.xlsx
This outputs ...
The module can be used to get particular column values or to stream records:
var Parser = ; sheet = 'sample.xlsx' 'Transcript'; // get values in a columnconsole; // stream parsed records as line-delimited JSONsheetrecordStream;
Output ...
Values in column `XYZ`: [ 'x', 'y', 'z', 'q', 'b' ]
{"_ID":"22","ROW":"1","LRB":"L","XYZ":"x"}
{"_ID":"22","ROW":"2","LRB":"L+L","XYZ":"y"}
{"_ID":"22","ROW":"3","LRB":"L+ ","XYZ":"z"}
{"_ID":"22","ROW":"4","LRB":"L+R+B","XYZ":"q"}
{"_ID":"22","ROW":"5","LRB":"L+R+X","XYZ":"b"}
See Also
valid-records
- validate specified fields within a set of records (ndjson)valid-xlsx
- validate values in columns of an excel worksheet