0.0.4 • Published 4 years ago

@tsart/xlsx2json v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

npm.io npm.io

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

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago