{"id":36789551,"url":"https://github.com/jo-hoe/google-sheets","last_synced_at":"2026-01-12T13:24:17.235Z","repository":{"id":46416970,"uuid":"420347133","full_name":"jo-hoe/google-sheets","owner":"jo-hoe","description":"idiomatic way to read and write data from google sheets","archived":false,"fork":false,"pushed_at":"2025-05-05T23:34:10.000Z","size":229,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T00:33:21.301Z","etag":null,"topics":["golang","google-sheets","google-spreadsheet","idiomatic","reader-writer","sheets"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jo-hoe.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}},"created_at":"2021-10-23T07:41:42.000Z","updated_at":"2025-05-05T23:33:12.000Z","dependencies_parsed_at":"2023-10-12T06:33:27.627Z","dependency_job_id":"2b139e2d-c0a0-48f1-ba82-6acab6192333","html_url":"https://github.com/jo-hoe/google-sheets","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jo-hoe/google-sheets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-hoe%2Fgoogle-sheets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-hoe%2Fgoogle-sheets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-hoe%2Fgoogle-sheets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-hoe%2Fgoogle-sheets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jo-hoe","download_url":"https://codeload.github.com/jo-hoe/google-sheets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-hoe%2Fgoogle-sheets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["golang","google-sheets","google-spreadsheet","idiomatic","reader-writer","sheets"],"created_at":"2026-01-12T13:24:17.116Z","updated_at":"2026-01-12T13:24:17.196Z","avatar_url":"https://github.com/jo-hoe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Sheets\n\n[![Go Reference](https://pkg.go.dev/badge/jo-hoe/google-sheets.svg)](https://pkg.go.dev/github.com/jo-hoe/google-sheets)\n[![Test Status](https://github.com/jo-hoe/google-sheets/workflows/test/badge.svg)](https://github.com/jo-hoe/google-sheets/actions?workflow=test)\n[![Coverage Status](https://coveralls.io/repos/github/jo-hoe/google-sheets/badge.svg?branch=main)](https://coveralls.io/github/jo-hoe/google-sheets?branch=main)\n[![Lint Status](https://github.com/jo-hoe/google-sheets/workflows/lint/badge.svg)](https://github.com/jo-hoe/google-sheets/actions?workflow=lint)\n[![CodeQL Status](https://github.com/jo-hoe/google-sheets/workflows/CodeQL/badge.svg)](https://github.com/jo-hoe/google-sheets/actions?workflow=CodeQL)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jo-hoe/google-sheets)](https://goreportcard.com/report/github.com/jo-hoe/google-sheets)\n\nProvides an idiomatic way to read and write data from google sheets.\n\n## Example Useage\n\n```golang\n// open the key file for your GCP service account (see below how to create that key file)\njsonServiceAccount, err := ioutil.ReadFile(\"path\\\\to\\\\service_account_key.json\")\nif err != nil {\n  log.Print(err.Error())\n  return\n}\n\n// spreadsheet id can be taken from the URL\n// example URL: https://docs.google.com/spreadsheets/d/c8ACvfAd4X09Hi9mCl4qcBidP635S8z5luk-vGG54N5T/edit#gid=0\n// the spreadsheet ID would be \"c8ACvfAd4X09Hi9mCl4qcBidP635S8z5lukxvGG54N5T\"\nsheet, err := gs.OpenSheet(context.Background(), \"c8ACvfAd4X09Hi9mCl4qcBidP635S8z5luk-vGG54N5T\", \"Sheet1\", gs.O_CREATE|gs.O_RDWR, jsonServiceAccount)\nif err != nil {\n  log.Print(err.Error())\n  return\n}\ncsvWriter := csv.NewWriter(sheet)\nerr = csvWriter.WriteAll([][]string{\n  {\"0\", \"1\"},\n  {\"2\", \"3\"},\n})\n\ncsvReader := csv.NewReader(sheet)\ncsvResult, err := csvReader.ReadAll()\nif err != nil {\n  log.Print(err.Error())\n  return\n}\nfmt.Printf(\"results: %v\", csvResult)\n\ngs.Remove(context.Background(), gs.SpreadSheetId(), gs.Id(), jsonServiceAccount)\n```\n\n### Incomplete Lines\n\nYour google sheet may include non complete lines.\n\n|Title A|Title B|\n|-------|-------|\n|0|1|\n|2| |\n\nIn this case you should deactivate the field length validation.\n\n```golang\ncsvReader := csv.NewReader(sheet)\ncsvReader.FieldsPerRecord = -1\ncsvResult, err := csvReader.ReadAll()\nif err != nil {\n  log.Print(err.Error())\n  return\n}\nfmt.Printf(\"results: %v\", csvResult)\n```\n\nThe output will be as follows\n\n```bash\nresult: [[\"Title A\" \"Title B\"][0 1] [2]]\n```\n\n## Google Sheets AuthN/AuthZ\n\n### General\n\nThe offical documentation can be found here: \u003chttps://developers.google.com/sheets/api/guides/authorizing\u003e.\n\n### Creating the key file\n\n1. [create a gcp service account](https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating)\n2. after creating the service account, ensure that google project in which the service account resides, is enabled to use the sheet api. You verifiy or enable the API using this url scheme \u003chttps://console.cloud.google.com/apis/library/sheets.googleapis.com?project=\u003e[my gcp project id]\n3. after the service account is created, take the mail address of that account and [share your spreadsheet with that mail address](https://support.google.com/a/users/answer/9305987?hl=en#)\n4. [create a json key for your GCP service account](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating)\n  \n## Linting\n\nProject used `golangci-lint` for linting.\n\n### Installation\n\n\u003chttps://golangci-lint.run/usage/install/\u003e\n\n### Execution\n\nRun the linting locally by executing\n\n```cli\ngolangci-lint run ./...\n```\n\nin the working directory\n\n## Testing\n\nThe project contains both unit and integrations tests.\n\n### Unit Test Execution\n\nThe unit test can be excuted using the default golang commands. To run all test execute the following in the parent folder of the repository.\n\n```powershell\ngo test ./...\n```\n\n### Integration Test Execution\n\nA credentials file and a google spreadsheet needed as prerequisite for the integration tests. You may use the following launch.json file in VSCode to run the tests.\n\n```json\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"API Wrapper Integration Tests\",\n            \"type\": \"go\",\n            \"request\": \"launch\",\n            \"mode\": \"test\",\n            \"program\": \"${workspaceFolder}/internal/apiwrapper/apiwrapper_integration_test.go\",\n            \"env\": {\n                \"CREDENTIALS_FILE_PATH\": \"C:\\\\Folder\\\\file-name-352919-3f8fa23b9bba.json\",\n                \"SPREADSHEET_ID\": \"1yxmv2lTtOtvpkBi-5hSMq86CHFMfYq6kdjfasudfasih\"\n            },\n        },{\n            \"name\": \"Sheets Integration Tests\",\n            \"type\": \"go\",\n            \"request\": \"launch\",\n            \"mode\": \"test\",\n            \"program\": \"${workspaceFolder}/gs/gs_integraton_test.go\",\n            \"env\": {\n                \"CREDENTIALS_FILE_PATH\": \"C:\\\\Folder\\\\file-name-352919-3f8fa23b9bba.json\",\n                \"SPREADSHEET_ID\": \"1yxmv2lTtOtvpkBi-5hSMq86CHFMfYq6kdjfasudfasih\"\n            },\n        },\n    ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjo-hoe%2Fgoogle-sheets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjo-hoe%2Fgoogle-sheets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjo-hoe%2Fgoogle-sheets/lists"}