{"id":15642027,"url":"https://github.com/revolunet/spreadsheet-to-json","last_synced_at":"2025-08-20T16:31:53.154Z","repository":{"id":1079352,"uuid":"39208889","full_name":"revolunet/spreadsheet-to-json","owner":"revolunet","description":"Convert Google Spreadsheets to JSON using Javascript","archived":false,"fork":false,"pushed_at":"2022-02-13T04:17:26.000Z","size":286,"stargazers_count":65,"open_issues_count":8,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-16T00:52:53.800Z","etag":null,"topics":["google-spreadsheet","javascript","json","nodejs","spread"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/revolunet.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}},"created_at":"2015-07-16T16:45:58.000Z","updated_at":"2025-07-23T18:26:20.000Z","dependencies_parsed_at":"2022-08-06T10:15:16.897Z","dependency_job_id":null,"html_url":"https://github.com/revolunet/spreadsheet-to-json","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/revolunet/spreadsheet-to-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revolunet%2Fspreadsheet-to-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revolunet%2Fspreadsheet-to-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revolunet%2Fspreadsheet-to-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revolunet%2Fspreadsheet-to-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/revolunet","download_url":"https://codeload.github.com/revolunet/spreadsheet-to-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revolunet%2Fspreadsheet-to-json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271349613,"owners_count":24744312,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["google-spreadsheet","javascript","json","nodejs","spread"],"created_at":"2024-10-03T11:53:39.756Z","updated_at":"2025-08-20T16:31:52.895Z","avatar_url":"https://github.com/revolunet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spreadsheet-to-json\n\n![npm](https://img.shields.io/npm/v/spreadsheet-to-json.svg) ![license](https://img.shields.io/npm/l/spreadsheet-to-json.svg) ![github-issues](https://img.shields.io/github/issues/revolunet/spreadsheet-to-json.svg) [![Circle CI build status](https://circleci.com/gh/revolunet/spreadsheet-to-json.svg?style=svg)](https://circleci.com/gh/revolunet/spreadsheet-to-json)\n\n![nodei.co](https://nodei.co/npm/spreadsheet-to-json.png?downloads=true\u0026downloadRank=true\u0026stars=true)\n\nConvert Google Spreadsheets to JSON using Javascript\n\nUses the [google-spreadsheet](https://www.npmjs.com/package/google-spreadsheet) library to fetch data.\n\nThe final JSON is based on sheets names and column titles and finally looks like this :\n\n```json\n{\n  \"Customers\": [\n    {\n      \"name\": \"Sony\",\n      \"country\": \"Japan\"\n    },\n    {\n      \"name\": \"Renault\",\n      \"country\": \"France\"\n    }\n  ],\n  \"Invoices\": [\n    {\n      \"id\": \"F0001\",\n      \"totalAmount\": \"12367.12\"\n    },\n    {\n      \"id\": \"F0002\",\n      \"totalAmount\": \"4398.2\"\n    }\n  ]\n}\n```\n\nThis can be useful when you want people edit spreadsheets and need to work with the data.\n\n## Install\n\n`npm i --save spreadsheet-to-json`\n\n## QuickStart\n\n`extractSheets` can use node callback pattern or async/await.\n\n```js\nconst { extractSheets } = require(\"spreadsheet-to-json\");\n\n// optional custom format cell function\nconst formatCell = (sheetTitle, columnTitle, value) =\u003e value.toUpperCase();\n\nextractSheets(\n  {\n    // your google spreadhsheet key\n    spreadsheetKey: \"abch54Ah75feBqKGiUjITgE9876Ypb0yE-abc\",\n    // your google oauth2 credentials or API_KEY\n    credentials: require(\"./google-generated-creds.json\"),\n    // optional: names of the sheets you want to extract\n    sheetsToExtract: [\"Customers\", \"Invoices\"],\n    // optional: custom function to parse the cells\n    formatCell: formatCell\n  },\n  function(err, data) {\n    console.log(\"Customers: \", data.Customers);\n    console.log(\"Invoices: \", data.Invoices);\n  }\n);\n```\n\nsee [./example.js](./example.js)\n\n## Authentification\n\nThe `credentials` key can either be a API_KEY `string` or a service account `object`.\n\n### API Key\n\nYou can create an API key here : https://console.developers.google.com/apis/credentials\n\nBe sure to restrict it to Google Drive API\n\n### Google service account\n\nCreate a credentials.json file for your app here : https://console.developers.google.com/\n\n- create a new project\n- enable the Drive API\n- in **credentials**, select **create new credentials** then **service account** and save the generated JSON. (privately)\n- then give the JSON contents to the `credentials` parameter in the `extractSheets` call.\n\nShare the target google spreadsheet with the `client_email` from the credentials.json.\n\n## Tests\n\n```\nextractSheet should produce correct data\n\n✓ sheet should have 5 rows\n✓ row should have 4 properties\n✓ row should have correct properties\n✓ name should be Johnny\n✓ id should be 1\n\nformatCell\n\n✓ names should not be equal\n✓ name should be uppercased\n✓ id should be 1\n\nextractSheets should produce correct data\n\n✓ data should have 3 sheets\n✓ sheets should have correct names\n✓ Private sheet should not be exported\n✓ Customers should have 5 rows\n✓ Customers properties names should equal id,name,location,Exotic_ Col-NAME\n✓ Invoices should have 9 rows\n✓ Invoices properties names should equal ref,amount\n✓ Leads should have 9 rows\n✓ Leads properties names should equal id,estimate,ref\n\nopen invalid spreadsheet should return empty data\n\n✓ invalid should have no rows\n\ncolumns with exotic names should be handled correctly\n\n✓ Exotic column name should exist in output\n✓ Exotic column name should be renamed in data\n✓ Exotic column name should be handled correctly\n\n\ntotal:     21\npassing:   21\nduration:  1.9s\n```\n\n## Author\n\nJulien Bouquillon \u003cjulien@bouquillon.com\u003e http://github.com/revolunet\n\n## License\n\n- **MIT** : http://opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevolunet%2Fspreadsheet-to-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frevolunet%2Fspreadsheet-to-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevolunet%2Fspreadsheet-to-json/lists"}