
xlsx2json
XLSX to JSON parser. Extract and combine Excel cells and datasets into JSON array.
Install
npm install @tsart/xlsx2json
Usage
import * as parser from '@tsart/xlsx2json';
let blob: any = fs.readFileSync('test.xls');
let files: parser.OutputFormat[] = parser.parseXLSX(config, blob);
See __test__ folder for other samples.
Config schema
This sample config defines A1, A2 cells and B4:C7 range to extract as JSON object.
domain: excel
fileName: test.xls
fileOptions:
cellDates: true
resultObjects:
- name: testDS
columns:
- ReportDate
- ReportTitle
dataset: Table
cells:
- name: ReportDate
sheetName: Sheet1
cell: A1
- name: ReportTitle
sheetName: Sheet1
cell: A2
datasets:
- name: Table
sheetName: Sheet1
range: B4:C7
Credits
Thank you daikiueda for sample XLSX files and a few good insights