@tsart/xlsx2json
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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

# Destination
resultObjects:
  - name: testDS
    columns:
      - ReportDate
      - ReportTitle
    dataset: Table

# Excel cells definitions
cells:
  - name: ReportDate
    sheetName: Sheet1
    cell: A1
  - name: ReportTitle
    sheetName: Sheet1
    cell: A2

# Excel datasets definitions
datasets:
  - name: Table
    sheetName: Sheet1
    range: B4:C7

Credits

Thank you daikiueda for sample XLSX files and a few good insights

Package Sidebar

Install

npm i @tsart/xlsx2json

Weekly Downloads

2

Version

0.0.4

License

MIT

Unpacked Size

84.2 kB

Total Files

43

Last publish

Collaborators

  • sart