npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spread2json

v2.0.2

Published

spreadsheet convert json

Downloads

92

Readme

NPM version Downloads

Spread2Json

Can be converted to JSON format any SpreadSheet data.

example SpreadSheet data

| | A | B | C | D | |:-:|:-------|:---------|:-----------------|---| | 1 | {} | | | | | 2 | _id | obj.code | obj.value:number | | | 3 | | | | | | 4 | first | one | 1 | | | 5 | second | two | 2 | | | 6 | | | | |

converted to Object

[
    {
        _id: 'first',
        obj: {
            code: 'one',
            value: 1
        }
    }, 
    {
        _id: 'second',
        obj: {
            code: 'two',
            value: 2
        }
    }
]

Installation

npm install spread2json

Usage

Quick start

example

| | A | B | C | D | |:-:|:---------------|:---------|:-----------------|---| | 1 | {name: 'Test'} | | | | | 2 | _id | obj.code | obj.value:number | | | 3 | | | | | | 4 | first | one | 1 | | | 5 | second | two | 2 | | | 6 | | | | |

Sheet1

var spread2json = require('spread2json');

var spreadsheetKye = 'spreadsheetkey';
var worksheetNames = ['Sheet1'];
spread2json.getWorksheetDatas(spreadsheetKey, worksheetNames, function(err, data) {
    console.log(data);
    // [{
    //    name: 'Sheet1',            // sheet name
    //    opts: { name: 'Test' },    // sheet option (A1)
    //    list: [
    //        { _id: 'first', obj: { code: 'one', value: 1 } }, { _id: 'second', obj: { code: 'two', value: 2 } }
    //    ]
    // }]

    spread2json.toJson(data, function(err, json) {
        console.log(json);
        // {
        //    Test: {
        //        first: {
        //            _id: 'first',
        //            obj: { code: 'one', value: 1 }
        //        },
        //        second: {
        //            _id: 'second',
        //            obj: { code: 'two', value: 2 }
        //        }
        //    }
        // }
    });
});

Setup

Setup options.

var spread2json = require('spread2json');

spread2json.setup({
  option_cell: 'A1',  // Cell with a custom sheet option. It is not yet used now. (default: 'A1'
  attr_line: 2,       // Line with a data attribute. (default: 2
  desc_line: 3,       // Line with a attribute description. (default: 3
  data_line: 4,       // Line with a data. (default: 4
  ref_keys: ['_id'],  // ref key. (default: ['_id']
  logger: customLogger, // custom Logger
  api: {
    client_id: 'YOUR CLIENT ID HERE',
    client_secret: 'YOUR CLIENT SECRET HERE',
    redirect_url: 'http://localhost',
    token_file: {
      use: true,
      path: './dist/token.json'
    }
  }
});

Sheet option

sheet option. setting with optionCell (default: 'A1'

  • name
  • type
  • key
  • attr_line
  • data_line
  • ref_keys

Attribute

Specify the key name.

Special character

  • # Use when the array.
  • $ Use when the split array.
  • :number or :num Use when the parameters of type Number.
  • :boolean or :bool Use when the parameters of type Boolean.
  • :date Use when the parameters of unix time.
  • :index Use when the array of array.

| | A | B | C | D | E | F | |:-:|:--------------|:-------|:------|:-----------|:-------------|:--------------------| | 1 | {} | | | | | | | 2 | _id | #arr | $sarr | num:number | bool:boolean | date:date | | 3 | | | | | | | | 4 | normal_string | array1 | a,b,c | 1 | FALSE | 2014/08/01 10:00:00 | | 5 | | array2 | | | | |

{
    _id: 'normal_string',
    arr: [ 'array1', 'array2' ],
    sarr: [ 'a', 'b', 'c' ],
    num: 1,
    bool: false,
    date: 1406854800000 // < new Date('2014/08/01 10:00:00').getTime() user env GMT
}

Sample

sample project. spread2json_sample

Contribution

  1. Fork it ( https://github.com/iyu/spread2json/fork )
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the npm test; npm run lint command and confirm that it passes
  6. Create new Pull Request