1.0.0 • Published 8 years ago

xlsx2json v1.0.0

Weekly downloads
846
License
MIT
Repository
github
Last release
8 years ago

xlsx2json Build Status Coverage Status Code Climate

NPM

Convert xlsx to JSON.

Install

$ npm install xlsx2json

Usage

Simple usage : )

var xlsx2json = require('xlsx2json');
xlsx2json('path_to_xlsx_file').then(jsonArray => {
    ...
});

xlsx2json(pathToXlsx, options, callback)

Arguments

  • pathToXlsx String

  • options Object (optional)

    • basheet

      • {Number} (*zero-based sheet index)
      • {String}
      • {Array}

      If options.sheet is not set, all sheets will be passed as Array.

    • keysRow {Number} (*one-based row position)

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

    • function(error, jsonArray) {}

Returns

  • Promise

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'
        }
    }
}).then(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"}
    ]
]

The result is the structure of a three-dimensional array.
In short, jsonArray[sheets][rows][cellValues]

Alternatively, if the option.sheet is set (as a String or a Number), only specific sheet will be passed.

1.0.0

8 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

11 years ago

0.0.1

11 years ago