Calculations JSON is made to simplify parse process for the following files:
- XLS
- XLSX
- CSV
That extensions works perfectly and on that extensions it has been tested out.
To install that module just type:
npm install calculations-json
After that just import that module:
const calculations = require('calculations-json');
To start using that module You will have to specify which file do You want to parse and convert into the JSON format.
There are 3 possibilities for now:
calculations.xlsToJson(config);
calculations.xlsxToJson(config);
calculations.csvToJson(config);
Configuration for that will be as following:
const config = {
input: {
type: 'file | stream', // stream or file (default 'file')
path: 'path to file', // relative path to the file
delimiter: ';' // delimiter (default ';')
},
options: {
headerLine: 0, // header line number
contentStartsAt: 1 // line from where the content starts
headerAsKey: false // if want selected header to be the keys
xlsSheetName: null // for xls and xlsx provide sheet name or the first one will be taken
},
excludedLines: [0,1] // lines to exclude
};
[X] Prepare output mechanisms
[X] Make the output fully configurable
© by Mike Makowski (2018)
Portfolio: MMakowski.Online
LinkedIn: WebEferen