{"id":16600585,"url":"https://github.com/savjee/google-sheets-wrapper","last_synced_at":"2025-03-23T14:31:11.093Z","repository":{"id":73407646,"uuid":"83815221","full_name":"Savjee/google-sheets-wrapper","owner":"Savjee","description":"Lightweight wrapper around the official Google Sheets API that makes it easy to read/write rows","archived":false,"fork":false,"pushed_at":"2017-03-13T08:21:52.000Z","size":125,"stargazers_count":38,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T21:07:41.331Z","etag":null,"topics":["google","nodejs","spreadsheet","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Savjee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-03-03T15:53:42.000Z","updated_at":"2025-03-08T15:53:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"6999c5cc-b387-46f2-bf04-7fb844b37215","html_url":"https://github.com/Savjee/google-sheets-wrapper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Savjee%2Fgoogle-sheets-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Savjee%2Fgoogle-sheets-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Savjee%2Fgoogle-sheets-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Savjee%2Fgoogle-sheets-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Savjee","download_url":"https://codeload.github.com/Savjee/google-sheets-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245115748,"owners_count":20563227,"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":["google","nodejs","spreadsheet","typescript"],"created_at":"2024-10-12T00:15:00.372Z","updated_at":"2025-03-23T14:31:11.080Z","avatar_url":"https://github.com/Savjee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-sheets-node\n\n[![Current version](https://img.shields.io/npm/v/google-sheets-wrapper.svg)](https://www.npmjs.com/package/google-sheets-wrapper)\n[![Downloads on npm](https://img.shields.io/npm/dt/google-sheets-wrapper.svg)](https://www.npmjs.com/package/google-sheets-wrapper)\n[![License](https://img.shields.io/npm/l/google-sheets-wrapper.svg)](/LICENSE)\n[![Build status](https://img.shields.io/travis/Savjee/google-sheets-wrapper.svg)](https://travis-ci.org/Savjee/google-sheets-wrapper)\n[![Dependencies](https://img.shields.io/david/savjee/google-sheets-wrapper.svg)](https://www.npmjs.com/package/google-sheets-wrapper)\n\nA lightweight wrapper around the official Google Sheets API that makes it easy to read and write rows. It's written in TypeScript and uses async/await to handle requests to Google's API.\n\n# Usage\nThe library only supports interacting with rows in Google Sheets. Not with columns or individual cells.\n\nWhen fetching rows, the library will map your data to Javascript objects. When inserting new rows, you can also use objects.\n\n## Authentication\nFollow step 1 of the official \"Node.js Quickstart\": [https://developers.google.com/sheets/api/quickstart/nodejs](https://developers.google.com/sheets/api/quickstart/nodejs). This will walk you through enabling the Sheets API and creating credentials (JSON file).\n\nAfterwards set the environment variable ``GOOGLE_APPLICATION_CREDENTIALS`` so that it contains the path to your credentials file. Could be something like this:\n\n```bash\nexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/credentials.json\n```\n\nOther methods of authenticating are currently not supported.\n\n## Header row\nThis library assumes that the first row in your spreadsheet is used as a header.\n\n![](https://savjee.github.io/google-sheets-wrapper/screenshots/header-row.png)\n\nThe header row is used to transform your rows to Javascript objects. Try to keep the values in the header simple (no spaces, no special characters, ...) The library will convert your titles to camelCase, so be aware of this. For example: ``Time posted`` will be converted to ``timePosted``.\n\n## Getting rows\nThis will map your rows to objects, using the first row of your spreadsheet as header (see \"Header row\"):\n\n```javascript\n// Open spreadsheet with ID XXXX-XXXX-XXXX and work with columns A to C in worksheet \"Sheet 1\"\nlet sheet = new GoogleSheet({\n    sheetId: \"XXXXXXXXXX-XXXXXXXXX-XXXXXXXX\",\n    range: \"'Sheet 1'!A:C\"\n});\n\n// Get the data\nlet data = await sheet.getRows();\n\n// Show it\nconsole.log(data);\n```\n\nFor example, this spreadsheet:\n\n![](https://savjee.github.io/google-sheets-wrapper/screenshots/simple-spreadsheet.png)\n\nWill be mapped to this:\n```\n[ \n    { timestamp: '1488806320466', message: 'Hi there!', user: 'Xavier' },\n    { timestamp: '1488806320467', message: 'We meet again.', user: 'Xavier' } \n]\n```\n\n## Writing new rows\nTo write new rows you have to construct an array of objects, much like the output of ``getRows()``. \nEach object will be inserted as a row:\n\n```javascript\n// Open spreadsheet with ID XXXX-XXXX-XXXX and work with columns A to C in worksheet \"Sheet 1\"\nlet sheet = new GoogleSheet({\n    sheetId: \"XXXXXXXXXX-XXXXXXXXX-XXXXXXXX\",\n    range: \"'Sheet 1'!A:C\"\n});\n\n// The data that we want to add to the spreadsheet\nlet data = [\n    {\n        timestamp: Date.now(),\n        message: 'Another message',\n        user: 'Peter'\n    },\n    {\n        timestamp: Date.now(),\n        message: 'Awesome work!',\n        user: 'Simon'\n    }\n]\n\nawait sheet.appendRows(data);\n```\n\n**Note:** the order of the fields doesn't matter. The library will match your data with the header row and insert it in the correct columns.\n\n**Warning:** the library will throw an error if your data contain a property that isn't in the header row. However, you can omit rows (they will be empty).\n\n# Contributing \u0026 License\nFeel free to fork this library, improve it or create issues and pull requests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavjee%2Fgoogle-sheets-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavjee%2Fgoogle-sheets-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavjee%2Fgoogle-sheets-wrapper/lists"}