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 = ; var spreadsheetKye = 'spreadsheetkey';var worksheetNames = 'Sheet1';spread2json;
Setup
Setup options.
var spread2json = ; spread2json;
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 typeNumber
.:boolean
or:bool
Use when the parameters of typeBoolean
.: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
- Fork it ( https://github.com/iyu/spread2json/fork )
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
npm test; npm run lint
command and confirm that it passes - Create new Pull Request