{"id":13479698,"url":"https://github.com/gglukmann/use-google-sheets","last_synced_at":"2026-01-27T12:35:20.560Z","repository":{"id":42516301,"uuid":"261738150","full_name":"gglukmann/use-google-sheets","owner":"gglukmann","description":"📝 A React Hook for getting data from Google Sheets API v4","archived":false,"fork":false,"pushed_at":"2025-11-15T10:59:44.000Z","size":2032,"stargazers_count":101,"open_issues_count":4,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-11-15T12:23:42.372Z","etag":null,"topics":["google-sheets","google-sheets-api","google-sheets-api-v4","hooks","react","react-hooks"],"latest_commit_sha":null,"homepage":"","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/gglukmann.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-05-06T11:28:19.000Z","updated_at":"2025-11-15T10:59:42.000Z","dependencies_parsed_at":"2023-02-08T08:15:25.921Z","dependency_job_id":"a643d65a-0f04-41a2-a9e2-0945a0e72941","html_url":"https://github.com/gglukmann/use-google-sheets","commit_stats":{"total_commits":66,"total_committers":4,"mean_commits":16.5,"dds":0.4545454545454546,"last_synced_commit":"70d47015f6a3812eab96e362c6a15cd60894b757"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/gglukmann/use-google-sheets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglukmann%2Fuse-google-sheets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglukmann%2Fuse-google-sheets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglukmann%2Fuse-google-sheets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglukmann%2Fuse-google-sheets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gglukmann","download_url":"https://codeload.github.com/gglukmann/use-google-sheets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglukmann%2Fuse-google-sheets/sbom","scorecard":{"id":425273,"data":{"date":"2025-08-11","repo":{"name":"github.com/gglukmann/use-google-sheets","commit":"69998a652144a8a38ebe5fee9aa3596d62d03f50"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/gglukmann/use-google-sheets/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/gglukmann/use-google-sheets/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/gglukmann/use-google-sheets/main.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"14 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xq7p-g2vc-g82p","Warn: Project is vulnerable to: GHSA-7hpj-7hhx-2fgx","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T02:07:05.401Z","repository_id":42516301,"created_at":"2025-08-19T02:07:05.401Z","updated_at":"2025-08-19T02:07:05.401Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28813215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-sheets","google-sheets-api","google-sheets-api-v4","hooks","react","react-hooks"],"created_at":"2024-07-31T16:02:21.611Z","updated_at":"2026-01-27T12:35:20.549Z","avatar_url":"https://github.com/gglukmann.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# useGoogleSheets\n\n## A React Hook wrapper library for [google-sheets-mapper](https://github.com/gglukmann/google-sheets-mapper) for getting data from [Google Sheets API v4](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values)\n\n[![Minified file size](https://badgen.net/bundlephobia/min/use-google-sheets)](https://bundlephobia.com/result?p=use-google-sheets) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![NPM version](https://img.shields.io/npm/v/use-google-sheets)](https://www.npmjs.com/package/use-google-sheets)\n\n---\n\n## Installation\n\n```bash\nnpm install use-google-sheets\n```\n\n```bash\npnpm add use-google-sheets\n```\n\n```bash\nbun add use-google-sheets\n```\n\nPackage available on [unpkg](https://www.unpkg.com/browse/use-google-sheets/).\n\n---\n\n## Usage\n\n1. Go to [Google Cloud Console](https://console.cloud.google.com/) to get API key for Google Sheets API.\n2. Create a Google Sheet and add some data. See [example sheet](https://docs.google.com/spreadsheets/d/1zbEyIfga05-gXTCVGejJHpl8ZrlcTYanvgnQBa1t2DM/edit#gid=0).\n3. Share it with \"Anyone with this link can view\".\n4. Get sheet id from url of the sheet.\n\n```html\nhttps://docs.google.com/spreadsheets/d/[THIS-IS-THE-SHEET-ID]/\n```\n\n5. I suggest adding API key and sheet id to `.env` file\n\n---\n\n## Examples\n\n### Get data from all sheets inside the spreadsheet\n\n```js\nimport useGoogleSheets, { Status } from \"use-google-sheets\";\n\nconst App = () =\u003e {\n  const { status, data, error } = useGoogleSheets({\n    apiKey: process.env.REACT_APP_GOOGLE_API_KEY,\n    sheetId: process.env.REACT_APP_GOOGLE_SHEETS_ID,\n  });\n\n  if (status === Status.pending) {\n    return \u003cdiv\u003eLoading...\u003c/div\u003e;\n  }\n\n  if (status === Status.error) {\n    return \u003cdiv\u003eError!\u003c/div\u003e;\n  }\n\n  return \u003cdiv\u003e{JSON.stringify(data)}\u003c/div\u003e;\n};\n```\n\n### Get data from specific sheets inside the spreadsheet\n\nDon't use single quotes on sheet names, they will be removed because when using space in sheet name it will be returned wrapped with single quotes and plugin will remove them for clean string id.\n\n```js\nimport useGoogleSheets, { Status } from \"use-google-sheets\";\n\nconst App = () =\u003e {\n  const { status, data } = useGoogleSheets({\n    apiKey: process.env.REACT_APP_GOOGLE_API_KEY,\n    sheetId: process.env.REACT_APP_GOOGLE_SHEETS_ID,\n    sheetsOptions: [{ id: \"Sheet1\" }],\n  });\n\n  if (status === Status.pending) {\n    return \u003cdiv\u003eLoading...\u003c/div\u003e;\n  }\n\n  if (status === Status.error) {\n    return \u003cdiv\u003eError!\u003c/div\u003e;\n  }\n\n  return \u003cdiv\u003e{JSON.stringify(data)}\u003c/div\u003e;\n};\n```\n\n### Refetch data from all sheets inside the spreadsheet\n\n```js\nimport useGoogleSheets, { Status } from \"use-google-sheets\";\n\nconst App = () =\u003e {\n  const { status, data, refetch } = useGoogleSheets({\n    apiKey: process.env.REACT_APP_GOOGLE_API_KEY,\n    sheetId: process.env.REACT_APP_GOOGLE_SHEETS_ID,\n  });\n\n  if (status === Status.pending) {\n    return \u003cdiv\u003eLoading...\u003c/div\u003e;\n  }\n\n  if (status === Status.error) {\n    return \u003cdiv\u003eError!\u003c/div\u003e;\n  }\n\n  return (\n    \u003cdiv\u003e\n      \u003cdiv\u003e{JSON.stringify(data)}\u003c/div\u003e\n\n      \u003cbutton onClick={refetch}\u003eRefetch\u003c/button\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n---\n\n## API Documentation\n\nThe `useGoogleSheets` hook takes an object with three properties:\n\n| Name          | Value  |\n| ------------- | ------ |\n| apiKey        | string |\n| sheetId       | string |\n| sheetsOptions | array  |\n\n- `apiKey` is a Google Sheets API v4 key from [Google Cloud Console](https://console.cloud.google.com/).\n- `sheetId` is the id of the sheet.\n- `sheetsOptions` is an array of specific objects `{ id, headerRowIndex }`. Can be left out then it will fallback to all sheets inside the spreadsheet and use first row from sheet as header.\n\n### Exposed Data\n\nThe hook produces an `HookState` object:\n\n```js\nconst { status, data, error, refetch, loading } = useGoogleSheets({\n  apiKey,\n  sheetId,\n});\n```\n\n| Name    | Value                                   |\n| ------- | --------------------------------------- |\n| status  | `\"pending\"` \\| `\"success\"` \\| `\"error\"` |\n| data    | array                                   |\n| error   | null or object                          |\n| refetch | function                                |\n| loading | boolean (deprecated, use `status`)      |\n\n- `status` indicates the current state of the request:\n  - `pending` - request is in-flight\n  - `success` - data received successfully\n  - `error` - request failed\n- `loading` is `true` when `status === \"pending\"` (deprecated).\n- `data` is an array of mapped data objects.\n\n```js\n[\n  {\n    id: \"Sheet1\",\n    data: [\n      { key: \"language\", value: \"et\" },\n      { key: \"title\", value: \"Test sheet\" },\n    ],\n  },\n];\n```\n\n- `error` lets you know when there is something wrong. It returns an error object where you can get specific error properties from `error.response`\n\n```js\n{\n  status: '404',\n  statusText: '',\n  url: 'https://sheets.googleapis.com/v4/spreadsheets/...',\n}\n```\n\n### Status Constant\n\nImport the `Status` constant for status comparisons:\n\n```js\nimport { Status } from \"use-google-sheets\";\n\nStatus.pending; // \"pending\"\nStatus.success; // \"success\"\nStatus.error; // \"error\"\n```\n\n## Migration from v2 to v3\n\n- New `status` field: `\"pending\"` | `\"success\"` | `\"error\"` (aligned with [TanStack Query](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery))\n- `loading` is still available but deprecated (use `status === \"pending\"`)\n- `called` has been removed\n\n## Migration from v1 to v2\n\n- Change `sheetsNames` array of string to `sheetsOptions` array of objects with `{ id: 'sheetName' }`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgglukmann%2Fuse-google-sheets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgglukmann%2Fuse-google-sheets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgglukmann%2Fuse-google-sheets/lists"}