xlsx2json

Convert xlsx to JSON.

xlsx2json

Convert xlsx to JSON.

$ npm install xlsx2json

Simple usage : )

var xlsx2json = require( "xlsx2json" );
xlsx2json( "path_to_xlsx_file", function( error, jsonArray ){
    ...
} );
  • pathToXlsx String

  • options Object (optional)

    • keysRow Number (*one-based row position)
    • mapping Object
    • dataStartingRow Number (*one-based row position)
  • callback Function (optional)

    • function( error, jsonArray ){}
  • promise ( Q promise - http://documentup.com/kriskowal/q/ )

for example : )
convert test/xlsx/with_header_information_and_keys_row.xlsx to jsonArray.

var xlsx2json = require( "xlsx2json" );
xlsx2json(
    "test/xlsx/with_header_information_and_keys_row.xlsx",
    {
        dataStartingRow: 4,
        mapping: {
            "col_1": "A",
            "col_2": "B",
            "col_3": "C"
        }
    }
} ).done( function( jsonArray ){ ... } );

The jsonArray is as follows : )

[
    { "col_1": "value 1-A", "col_1": "value 1-B", "col_3": "value 1-C" },
    { "col_1": "value 2-A", "col_2": "value 2-B", "col_3": "value 2-C" }
]