xl-json

4.0.0 • Public • Published

#xl-json

Converts a complete excel spreadsheet to json in either object, as file or stream to a pipeline. Module only works for nodejs version 4 or higher

Current Version dependency Status devDependency Status Build Status Coveralls

Install

npm install xl-json

Example

const Converter = require('xl-json');


const options = {
    input: Path.resolve(__dirname, './test/excel/relationship.xlsx'),
    output: '../output/relationship',
    spacer: 2, // optional for JSON.stringify
    replacer: ['key'] // optional array or function to be passed to JSON.stringify
    formatter: {
        organisation: formatter
    } // optional object with keys representing the name of sheet within workbook you would like to format and the value is a function that takes one parameter which is an array of objects.  Defaults to standard format which doesn't affect parsing done by j module

};

const results = new Converter(options);

// return json stringified object with keys of object being the worksheet name

const jsonObj = results.toJson();



// Also exposes a stream which can be written or piped somewhere

results.streamSheet('customer').pipe(process.stdout);
results.streamBook().pipe(process.stdout);

Cli usage

xl-json
  • -i, --i or --input to set the input path of excel file to be converted
  • -o, --o or --ouput to select the destination for converted json to be written to
  • -f, --f or --formatters location of formatters object to be used to parse excel
  • -v, --v or --version will display the current version of package
  • -h - will show usage of cli

###Todo

  • Add ability to parse, write and stream multiple spreadsheets

Package Sidebar

Install

npm i xl-json

Weekly Downloads

7

Version

4.0.0

License

BSD-3-Clause

Unpacked Size

70.4 kB

Total Files

15

Last publish

Collaborators

  • simon-p-r