{"id":25931137,"url":"https://github.com/iyu/spread2json","last_synced_at":"2025-03-03T23:58:01.482Z","repository":{"id":19953382,"uuid":"23220209","full_name":"iyu/spread2json","owner":"iyu","description":"spredsheet data convert json","archived":false,"fork":false,"pushed_at":"2023-07-19T01:55:30.000Z","size":540,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T20:07:43.508Z","etag":null,"topics":["javascript","nodejs","spreadsheet-data"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iyu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-08-22T09:30:42.000Z","updated_at":"2024-07-05T10:35:35.552Z","dependencies_parsed_at":"2023-01-13T20:41:41.658Z","dependency_job_id":null,"html_url":"https://github.com/iyu/spread2json","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyu%2Fspread2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyu%2Fspread2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyu%2Fspread2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyu%2Fspread2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iyu","download_url":"https://codeload.github.com/iyu/spread2json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241758970,"owners_count":20015248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","spreadsheet-data"],"created_at":"2025-03-03T23:58:00.950Z","updated_at":"2025-03-03T23:58:01.469Z","avatar_url":"https://github.com/iyu.png","language":"TypeScript","readme":"[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][downloads-url]\n[![GitHub Actions status][github-action-image]][github-url]\n\n\nSpread2Json\n==========\n\nCan be converted to JSON format any SpreadSheet data.\n\nexample SpreadSheet data\n\n|   | A      | B        | C                | D |\n|:-:|:-------|:---------|:-----------------|---|\n| 1 | {}     |          |                  |   |\n| 2 | \\_id   | obj.code | obj.value:number |   |\n| 3 |        |          |                  |   |\n| 4 | first  | one      | 1                |   |\n| 5 | second | two      | 2                |   |\n| 6 |        |          |                  |   |\n\nconverted to Object\n```js\n[\n    {\n        _id: 'first',\n        obj: {\n            code: 'one',\n            value: 1\n        }\n    }, \n    {\n        _id: 'second',\n        obj: {\n            code: 'two',\n            value: 2\n        }\n    }\n]\n```\n\n## Installation\n```\nnpm install spread2json\n```\n\n## Usage\n### Quick start\nexample\n\n|   | A              | B        | C                | D |\n|:-:|:---------------|:---------|:-----------------|---|\n| 1 | {name: 'Test'} |          |                  |   |\n| 2 | \\_id           | obj.code | obj.value:number |   |\n| 3 |                |          |                  |   |\n| 4 | first          | one      | 1                |   |\n| 5 | second         | two      | 2                |   |\n| 6 |                |          |                  |   |\n\nSheet1\n```js\nvar spread2json = require('spread2json');\n\nvar spreadsheetKye = 'spreadsheetkey';\nvar worksheetNames = ['Sheet1'];\nspread2json.getWorksheetDatas(spreadsheetKey, worksheetNames, function(err, data) {\n    console.log(data);\n    // [{\n    //    name: 'Sheet1',            // sheet name\n    //    opts: { name: 'Test' },    // sheet option (A1)\n    //    list: [\n    //        { _id: 'first', obj: { code: 'one', value: 1 } }, { _id: 'second', obj: { code: 'two', value: 2 } }\n    //    ]\n    // }]\n\n    spread2json.toJson(data, function(err, json) {\n        console.log(json);\n        // {\n        //    Test: {\n        //        first: {\n        //            _id: 'first',\n        //            obj: { code: 'one', value: 1 }\n        //        },\n        //        second: {\n        //            _id: 'second',\n        //            obj: { code: 'two', value: 2 }\n        //        }\n        //    }\n        // }\n    });\n});\n```\n\n### Setup\nSetup options.\n```js\nvar spread2json = require('spread2json');\n\nspread2json.setup({\n  option_cell: 'A1',  // Cell with a custom sheet option. It is not yet used now. (default: 'A1'\n  attr_line: 2,       // Line with a data attribute. (default: 2\n  desc_line: 3,       // Line with a attribute description. (default: 3\n  data_line: 4,       // Line with a data. (default: 4\n  ref_keys: ['_id'],  // ref key. (default: ['_id']\n  logger: customLogger, // custom Logger\n  api: {\n    client_id: 'YOUR CLIENT ID HERE',\n    client_secret: 'YOUR CLIENT SECRET HERE',\n    redirect_url: 'http://localhost',\n    token_file: {\n      use: true,\n      path: './dist/token.json'\n    }\n  }\n});\n```\n\n### Sheet option\nsheet option. setting with optionCell (default: 'A1'\n* `name`\n* `type`\n* `key`\n* `attr_line`\n* `data_line`\n* `ref_keys`\n\n\n### Attribute\nSpecify the key name.\n\n**Special character**\n* `#` Use when the array.\n* `$` Use when the split array.\n* `:number` or `:num` Use when the parameters of type `Number`.\n* `:boolean` or `:bool` Use when the parameters of type `Boolean`.\n* `:date` Use when the parameters of unix time.\n* `:index` Use when the array of array.\n\n|   | A             | B      | C     | D          | E            | F                   |\n|:-:|:--------------|:-------|:------|:-----------|:-------------|:--------------------|\n| 1 | {}            |        |       |            |              |                     |\n| 2 | \\_id           | #arr   | $sarr | num:number | bool:boolean | date:date           |\n| 3 |               |        |       |            |              |                     |\n| 4 | normal\\_string | array1 | a,b,c | 1          | FALSE        | 2014/08/01 10:00:00 |\n| 5 |               | array2 |       |            |              |                     |\n```\n{\n    _id: 'normal_string',\n    arr: [ 'array1', 'array2' ],\n    sarr: [ 'a', 'b', 'c' ],\n    num: 1,\n    bool: false,\n    date: 1406854800000 // \u003c new Date('2014/08/01 10:00:00').getTime() user env GMT\n}\n```\n\n### Sample\nsample project.\n[spread2json_sample](https://github.com/iyu/spread2json_sample)\n\n## Contribution\n1. Fork it ( [https://github.com/iyu/spread2json/fork](https://github.com/iyu/spread2json/fork) )\n2. Create a feature branch\n3. Commit your changes\n4. Rebase your local changes against the master branch\n5. Run test suite with the `npm test; npm run lint` command and confirm that it passes\n5. Create new Pull Request\n\n[github-url]: https://github.com/iyu/spread2json\n[github-action-image]: https://github.com/iyu/spread2json/workflows/Lint%20and%20Test/badge.svg\n[npm-image]: https://img.shields.io/npm/v/spread2json.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/spread2json\n[downloads-image]: https://img.shields.io/npm/dm/spread2json.svg?style=flat-square\n[downloads-url]: https://www.npmjs.com/package/spread2json\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyu%2Fspread2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiyu%2Fspread2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyu%2Fspread2json/lists"}