New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

excel2json

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

excel2json

excel2json

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Excel2Json

Can be converted to JSON format any Excel data.

example Excel data

ABCD
1{}
2_idobj.codeobj.value:number
3
4firstone1
5secondtwo2
6
converted to Object
[
    {
        _id: 'first',
        obj: {
            code: 'one',
            value: 1
        }
    }, 
    {
        _id: 'second',
        obj: {
            code: 'two',
            value: 2
        }
    }
]

Installation

npm install git+https://github.com/yuhei-a/excel2json.git@0.0.1

Usage

Quick start

example sheet.xlsx

ABCD
1{}
2_idobj.codeobj.value:number
3
4firstone1
5secondtwo2
6
var excel2json = require('excel2json');

excel2json.parse('./sheet.xlsx', function(err, data) {
    console.log(data);
    // [ { _id: 'first', obj: { code: 'one', value: 1 } }, { _id: 'second', obj: { code: 'two', value: 2 } } ]
});

Setup

Setup options.

var excel2json = require('excel2json');

excel2json.setup({
    optionCell: 'A1', // Cell with a custom sheet option. It is not yet used now. (default: 'A1'
    attrLine: '2',    // Line with a data attribute. (default: '2'
    dataLine: '4'     // Line with a data. (default: '4'
});

Attribute

Specify the key name.

Special character

  • # Use when the array.
  • :number Use when the parameters of type Number.
  • :boolean Use when the parameters of type Boolean.
  • :index Use when the array of array.

An example of a complex format

Data to be expected.

[
    {
        _id: 'test1',
        arr: [
            {
                code: 'test1_1',
                list: [ [ 1, 2 ], [ 3, 4 ] ],
                arr: [
                    { code: 'test1_1_1', is: true },
                    { code: 'test1_1_2', is: false }
                ]
            },
            {
                code: 'test1_2',
                list: [ [ 5, 6, 7 ], [ 8 ] ],
                arr: [
                    { code: 'test1_2_1', is: true },
                    { code: 'test1_2_2', is: false }
                ]
            }
        ]
    },
    {
        _id: 'test2',
        arr: [
            {
                code: 'test2_1',
                list: [ [ 1 ], [ 2 ], [ 3 ], [ 4 ] ],
                arr: [
                    { code: 'test2_1_1', is: true },
                    { code: 'test2_1_2', is: false }
                ]
            },
            {
                code: 'test2_2',
                list: [ [ 5, 6, 7 ], [ 8 ] ],
                arr: [
                    { code: 'test2_2_1', is: true },
                    { code: 'test2_2_2', is: false }
                ]
            }
        ]
    }
]

Necessary Excel data.

ABCDEFG
1{}
2_id#arr:index#arr.code#arr.#list:index#arr.#list.#:number#arr.#arr.code#arr.#arr.is:boolean
3
4test10test1_101test1_1_1true
5002test1_1_2false
6013
7014
81test1_205test1_2_1true
9106test1_2_2false
10107
11118
12test20test2_101test2_1_1true
13012test2_1_2false
14023
15034
161test2_205test2_2_1true
17106test2_2_2false
18107
19118

Test

Run npm test and npm run-script jshint

Keywords

FAQs

Package last updated on 30 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc