{"_id":"@alexvimbly/google-spreadsheet","name":"@alexvimbly/google-spreadsheet","dist-tags":{"latest":"3.3.1"},"versions":{"3.3.1":{"author":{"name":"Alexander Tranvaag","email":"alextranvaag@gmail.com","url":"https://alextranvaag.com"},"contributors":[{"name":"Theo Ephraim","email":"theozero@gmail.com","url":"https://theoephraim.com"}],"name":"@alexvimbly/google-spreadsheet","description":"Google Sheets API (v4) -- simple interface to read/write data and manage sheets","version":"3.3.1","license":"Unlicense","keywords":["google spreadsheets","google sheets","google docs","google","spreadsheet","spreadsheets","sheets","gdata","api","googleapis"],"homepage":"https://theoephraim.github.io/node-google-spreadsheet","repository":{"type":"git","url":"git://github.com/theoephraim/node-google-spreadsheet.git"},"main":"index.js","engines":{"node":">=0.8.0"},"dependencies":{"axios":"^0.21.4","google-auth-library":"^6.1.3","lodash":"^4.17.21"},"devDependencies":{"delay":"^4.3.0","docsify-cli":"^4.4.3","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-async-await":"0.0.0","eslint-plugin-import":"^2.20.0","eslint-plugin-jest":"^23.6.0","husky":"^4.2.0","jest":"^24.9.0","jest-junit":"^10.0.0"},"scripts":{"test":"jest --runInBand","lint":"eslint ./","lint:fix":"eslint ./ --fix","docs:preview":"docsify serve docs","readme:copy":"echo \"<!-- DO NOT EDIT THIS FILE, EDIT MAIN README.md AND RUN \\`npm readme:copy\\` instead -->\n\n_Welcome to the docs site for_\n\" | cat - README.md > docs/README.md"},"husky":{"hooks":{"pre-commit":"npm run lint","pre-push":"npm run test"}},"jest":{"testEnvironment":"node","testTimeout":10000,"coveragePathIgnorePatterns":["/node_modules/","/examples/","/test/"]},"gitHead":"255d4ed36f13b62f0cd45753ac90eb653caed746","bugs":{"url":"https://github.com/theoephraim/node-google-spreadsheet/issues"},"_id":"@alexvimbly/google-spreadsheet@3.3.1","_nodeVersion":"14.19.3","_npmVersion":"6.14.17","dist":{"integrity":"sha512-lIpMszNnRYykLMFynlz7JxZQz97pqc/7dHqXO/KqnzpbCE834sWaa0KE/056gAoWrys2ba5zYUOMrOBBJ6Uk3A==","shasum":"b800e671ccbc2f9aa4011d85f5815d0a66926621","tarball":"https://registry.npmjs.org/@alexvimbly/google-spreadsheet/-/google-spreadsheet-3.3.1.tgz","fileCount":17,"unpackedSize":77236,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDY24fwnlvorFj0XDGyNXL3Fh3PkFRSpK21+HprzRKjRQIhAMphgDvNJjIX6Mdaujyj0/PwHQ2c2rvjU3YNj1A+HXRa"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi7C8tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpF/Q/+Le8FcFOku9mr/Nq/4ptMlrYDf3fjFH8BA6dMCdZg32Ocjj/O\r\nUvJH/4pJBp3JHcHBVlwa/i4aoofPWLouA3V303zYOsjoq3LKGllYoUUhuAXm\r\nBG8XESFY8wzqvWAWpYVMnVqwf8Qy6DquylALFZTMg0FbKKTxmE0twvX08rII\r\n0K/ZW0k2Z4TzZfFCpevO99sy40qBFxYj6cFuGsrVobyyEOgxL3xsmnglqDc/\r\nlLZjEPDsbdUbwPR/48f8sIgDdFMBUZv1ROlbQKS1pXnI1U5NpSJu7VKU2aST\r\n/UUm7tY5BTVIPWheAadj5qfeS18o5EbUesrOVahLV2LAz9GoHl1nVnW7YlPA\r\nVJYGRsbgMoTUquVfHVtQeouUYQwkuzPFS8Iv7ISaoMz4bZAqoP+HyaWInuo8\r\nXqyKci+ICmIwwX36xA5lBkHi6a8QQwGNpej2k1+I5WlOKRebInIJWX7rWjZ6\r\nIFf2r2kSqfcc6G7CpCrFrZlE9GCyGBQZvzdInCpXlokrNdMvC56al9px5Gcu\r\nys1isOV30tVa49Y27YLfRRfKXGTpe/uFA96q8+1l5pZNfP7hBocrOAthpKoy\r\nryx2/y15VrRz5p/YYJ5Ovk0LI8Bdmb2qKU+SBpFryHGW5QQbOUh/v0iIviro\r\nURXQkyYFJroNtqam9tQY+JefpYZ8eaQJDJQ=\r\n=Zkuv\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"alexvimbly","email":"alex@vimbly.com"},"directories":{},"maintainers":[{"name":"alexvimbly","email":"alex@vimbly.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/google-spreadsheet_3.3.1_1659645741628_0.579230936187054"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-04T20:42:21.564Z","3.3.1":"2022-08-04T20:42:21.832Z","modified":"2022-08-04T20:42:21.976Z"},"maintainers":[{"name":"alexvimbly","email":"alex@vimbly.com"}],"description":"Google Sheets API (v4) -- simple interface to read/write data and manage sheets","homepage":"https://theoephraim.github.io/node-google-spreadsheet","keywords":["google spreadsheets","google sheets","google docs","google","spreadsheet","spreadsheets","sheets","gdata","api","googleapis"],"repository":{"type":"git","url":"git://github.com/theoephraim/node-google-spreadsheet.git"},"contributors":[{"name":"Theo Ephraim","email":"theozero@gmail.com","url":"https://theoephraim.com"}],"author":{"name":"Alexander Tranvaag","email":"alextranvaag@gmail.com","url":"https://alextranvaag.com"},"bugs":{"url":"https://github.com/theoephraim/node-google-spreadsheet/issues"},"license":"Unlicense","readme":"# google-spreadsheet\n> The most popular [Google Sheets API](https://developers.google.com/sheets/api/reference/rest) wrapper for javascript\n\n[![NPM version](https://img.shields.io/npm/v/google-spreadsheet)](https://www.npmjs.com/package/google-spreadsheet)\n[![CircleCI](https://circleci.com/gh/theoephraim/node-google-spreadsheet.svg?style=shield)](https://circleci.com/gh/theoephraim/node-google-spreadsheet)\n[![Known Vulnerabilities](https://snyk.io/test/github/theoephraim/node-google-spreadsheet/badge.svg?targetFile=package.json)](https://snyk.io/test/github/theoephraim/node-google-spreadsheet?targetFile=package.json)\n[![NPM](https://img.shields.io/npm/dw/google-spreadsheet)](https://www.npmtrends.com/google-spreadsheet)\n\n- multiple auth options - service account (w/ optional impersonation), OAuth 2.0, API key (read-only)\n- cell-based API - read, write, bulk-updates, formatting\n- row-based API - read, update, delete (based on the old v3 row-based calls)\n- managing worksheets - add, remove, resize, change title, formatting\n\n**Docs site -**\nFull docs available at [https://theoephraim.github.io/node-google-spreadsheet](https://theoephraim.github.io/node-google-spreadsheet)\n\n> **🚨 Google Deprecation Warning - affects older version (v2) of this module 🚨**\n>\n> Google is [phasing out their old v3 api](https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api), which the older version of this module used. Originally they were going to shut it down on March 3rd 2020, but have pushed that date back to June 2021.\n\n\n**Regardless, please upgrade to the latest version of this module (v3) which uses the newer sheets v4 API**\n\n-------------\n\n> 🌈 **Installation** - `npm i google-spreadsheet --save` or `yarn add google-spreadsheet`\n\n## Examples\n_the following examples are meant to give you an idea of just some of the things you can do_\n\n> **IMPORTANT NOTE** - To keep the examples concise, I'm calling await [at the top level](https://v8.dev/features/top-level-await) which is not allowed by default in most versions of node. If you need to call await in a script at the root level, you must instead wrap it in an async function like so:\n\n```javascript\n(async function() {\n  await someAsyncFunction();\n}());\n```\n\n\n### The Basics\n```javascript\nconst { GoogleSpreadsheet } = require('google-spreadsheet');\n\n// Initialize the sheet - doc ID is the long id in the sheets URL\nconst doc = new GoogleSpreadsheet('<the sheet ID from the url>');\n\n// Initialize Auth - see https://theoephraim.github.io/node-google-spreadsheet/#/getting-started/authentication\nawait doc.useServiceAccountAuth({\n  // env var values are copied from service account credentials generated by google\n  // see \"Authentication\" section in docs for more info\n  client_email: process.env.GOOGLE_SERVICE_ACCOUNT_EMAIL,\n  private_key: process.env.GOOGLE_PRIVATE_KEY,\n});\n\nawait doc.loadInfo(); // loads document properties and worksheets\nconsole.log(doc.title);\nawait doc.updateProperties({ title: 'renamed doc' });\n\nconst sheet = doc.sheetsByIndex[0]; // or use doc.sheetsById[id] or doc.sheetsByTitle[title]\nconsole.log(sheet.title);\nconsole.log(sheet.rowCount);\n\n// adding / removing sheets\nconst newSheet = await doc.addSheet({ title: 'hot new sheet!' });\nawait newSheet.delete();\n```\nMore info:\n- [GoogleSpreadsheet](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet)\n- [GoogleSpreadsheetWorksheet](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-worksheet)\n- [Authentication](https://theoephraim.github.io/node-google-spreadsheet/#/getting-started/authentication)\n\n\n\n### Working with rows\n```javascript\n// create a sheet and set the header row\nconst sheet = await doc.addSheet({ headerValues: ['name', 'email'] });\n\n// append rows\nconst larryRow = await sheet.addRow({ name: 'Larry Page', email: 'larry@google.com' });\nconst moreRows = await sheet.addRows([\n  { name: 'Sergey Brin', email: 'sergey@google.com' },\n  { name: 'Eric Schmidt', email: 'eric@google.com' },\n]);\n\n// read rows\nconst rows = await sheet.getRows(); // can pass in { limit, offset }\n\n// read/write row values\nconsole.log(rows[0].name); // 'Larry Page'\nrows[1].email = 'sergey@abc.xyz'; // update a value\nawait rows[1].save(); // save updates\nawait rows[1].delete(); // delete a row\n```\nMore info:\n- [GoogleSpreadsheetWorksheet > Working With Rows](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-worksheet#working-with-rows)\n- [GoogleSpreadsheetRow](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-row)\n\n\n\n### Working with cells\n```javascript\nawait sheet.loadCells('A1:E10'); // loads range of cells into local cache - DOES NOT RETURN THE CELLS\nconsole.log(sheet.cellStats); // total cells, loaded, how many non-empty\nconst a1 = sheet.getCell(0, 0); // access cells using a zero-based index\nconst c6 = sheet.getCellByA1('C6'); // or A1 style notation\n// access everything about the cell\nconsole.log(a1.value);\nconsole.log(a1.formula);\nconsole.log(a1.formattedValue);\n// update the cell contents and formatting\na1.value = 123.456;\nc6.formula = '=A1';\na1.textFormat = { bold: true };\nc6.note = 'This is a note!';\nawait sheet.saveUpdatedCells(); // save all updates in one call\n```\nMore info:\n- [GoogleSpreadsheetWorksheet > Working With Cells](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-worksheet#working-with-cells)\n- [GoogleSpreadsheetCell](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-cell)\n\n\n\n## Why?\n> **This module provides an intuitive wrapper around Google's API to simplify common interactions**\n\nWhile Google's v4 sheets api is much easier to use than v3 was, the official [googleapis npm module](https://www.npmjs.com/package/googleapis) is a giant meta-tool that handles _every Google product_. The module and the API itself are awkward and the docs are pretty terrible, at least to get started.\n\n**In what situation should you use Google's API directly?**<br>\nThis module makes trade-offs for simplicity of the interface.\nGoogle's API provides a mechanism to make many requests in parallel, so if speed and efficiency is extremely important to your use case, you may want to use their API directly. There are also several features of their API that are not implemented here yet.\n\n\n## Support & Contributions\n\nThis module was written and is actively maintained by [Theo Ephraim](https://theoephraim.com).\n\n**Are you actively using this module for a commercial project? Want to help support it?**<br>\n[Buy Theo a beer](https://paypal.me/theoephraim)\n\n#### Sponsors\n\nNone yet - get in touch!\n\n#### Contributing\n\nContributions are welcome, but please follow the existing conventions, use the linter, add relevant tests, add relevant documentation.\n\nThe docs site is generated using [docsify](https://docsify.js.org). To preview and run locally so you can make edits, run `npm run docs:preview` and head to http://localhost:3000\nThe content lives in markdown files in the docs folder.\n\n## License\nThis is free and unencumbered public domain software. For more info, see https://unlicense.org.\n","readmeFilename":"README.md"}