0.9.3 • Published 7 years ago

node-xlsx2json v0.9.3

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

Introduction

Excel XLSX document to JSON converter as a Node.js library and a command line utility.

Getting Started

Install the package:

npm install -g node-xlsx2json

Convert the document:

xlsx2json --verbose path/to/sample.xlsx sample.json

Command Line

Usage:
  xslx2json [options] <input.xlsx> <output.json>

Options:
  --force         Force overwrite file
  --help          Print this message
  --verbose       Enable detailed logging
  --version       Print version number

Examples:
  xlsx2json --version
  xlsx2json --verbose file.xlsx
  xlsx2json --force file.xlsx file.json

Using as library

var xlsx2json = require('node-xlsx2json');
xlsx2json('path/to/sample.xlsx', function(error, result) {
  if (error) return console.error(error);
  console.log(result);
});

Example of output

{
  "worksheets": [
    {
      "sheetId": 1,
      "name": "Blank",
      "data": []
    },
    {
      "sheetId": 2,
      "name": "Calculate",
      "data": [
        {
          "cell": "A1",
          "value": "1"
        },
        {
          "cell": "A2",
          "value": "2"
        },
        {
          "cell": "A3",
          "formula": "=SUM(A1:A2)",
          "value": "3"
        },
        {
          "cell": "C3",
          "formula": "=2 * (PI() / 4)",
          "value": "1.5707963267948966"
        }
      ]
    },
    {
      "sheetId": 3,
      "name": "Variables",
      "data": [
        {
          "cell": "A1",
          "type": "string",
          "value": "xlsx2json"
        },
        {
          "cell": "A2",
          "value": "1234"
        },
        {
          "cell": "A3",
          "value": "1",
          "display": "1",
          "format": "0"
        },
        {
          "cell": "A4",
          "value": "10"
        },
        {
          "cell": "A5",
          "value": "0.99",
          "display": "99%",
          "format": "0%"
        },
        {
          "cell": "A6",
          "value": "0.5625"
        }
      ]
    }
  ]
}
0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago