{"id":13736551,"url":"https://github.com/tidyverse/googlesheets4","last_synced_at":"2025-05-08T12:33:05.679Z","repository":{"id":38827814,"uuid":"89657511","full_name":"tidyverse/googlesheets4","owner":"tidyverse","description":"Google Spreadsheets R API (reboot of the googlesheets package)","archived":false,"fork":false,"pushed_at":"2024-10-29T11:19:22.000Z","size":29708,"stargazers_count":359,"open_issues_count":35,"forks_count":51,"subscribers_count":24,"default_branch":"main","last_synced_at":"2024-10-29T13:18:52.908Z","etag":null,"topics":["google-drive","google-sheets","r","spreadsheet"],"latest_commit_sha":null,"homepage":"https://googlesheets4.tidyverse.org","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidyverse.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-28T02:03:33.000Z","updated_at":"2024-10-19T22:02:32.000Z","dependencies_parsed_at":"2023-02-18T23:15:46.612Z","dependency_job_id":"6774c1a1-9161-48b0-9b2a-8515518d0807","html_url":"https://github.com/tidyverse/googlesheets4","commit_stats":{"total_commits":897,"total_committers":12,"mean_commits":74.75,"dds":0.0735785953177257,"last_synced_commit":"b3eeecf680f7864a39930b76d156e0310029d8aa"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fgooglesheets4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fgooglesheets4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fgooglesheets4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fgooglesheets4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidyverse","download_url":"https://codeload.github.com/tidyverse/googlesheets4/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224732129,"owners_count":17360416,"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-drive","google-sheets","r","spreadsheet"],"created_at":"2024-08-03T03:01:23.883Z","updated_at":"2024-11-15T04:32:02.080Z","avatar_url":"https://github.com/tidyverse.png","language":"R","funding_links":[],"categories":["R","Backend"],"sub_categories":["G Suite Integration"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\ncan_decrypt \u003c- gargle::secret_has_key(\"GOOGLESHEETS4_KEY\")\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  error = TRUE,\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  purl = can_decrypt,\n  eval = can_decrypt\n)\noptions(tibble.print_min = 5L, tibble.print_max = 5L)\n```\n\n```{r eval = !can_decrypt, echo = FALSE, comment = NA}\nmessage(\"No token available. Code chunks will not be evaluated.\")\n```\n\n```{r readme-auth, include = FALSE}\ngooglesheets4:::gs4_auth_docs()\n```\n\n# googlesheets4 \u003ca href=\"https://googlesheets4.tidyverse.org\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" alt = \"\"/\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/googlesheets4)](https://CRAN.R-project.org/package=googlesheets4)\n[![R-CMD-check](https://github.com/tidyverse/googlesheets4/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidyverse/googlesheets4/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/tidyverse/googlesheets4/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/googlesheets4?branch=main)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\ngooglesheets4 provides an R interface to [Google Sheets](https://docs.google.com/spreadsheets/) via the [Sheets API v4](https://developers.google.com/sheets/api/). It is a reboot of an earlier package called [googlesheets](https://github.com/jennybc/googlesheets#readme).\n\n*Why **4**? Why googlesheets**4**? Did I miss googlesheets1 through 3? No. The idea is to name the package after the corresponding version of the Sheets API. In hindsight, the original googlesheets should have been googlesheets**3**.*\n\n## Installation\n\nYou can install the released version of googlesheets4 from [CRAN](https://CRAN.R-project.org) with:\n\n```{r, eval = FALSE}\ninstall.packages(\"googlesheets4\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n```{r eval = FALSE}\n#install.packages(\"pak\")\npak::pak(\"tidyverse/googlesheets4\")\n```\n\n## Cheatsheet\n\nYou can see how to read data with googlesheets4 in the **data import cheatsheet**, which also covers similar functionality in the related packages readr and readxl.\n\n\u003ca href=\"https://github.com/rstudio/cheatsheets/blob/main/data-import.pdf\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/rstudio/cheatsheets/main/pngs/thumbnails/data-import-cheatsheet-thumbs.png\" width=\"630\" height=\"252\" alt=\"thumbnail of data import cheatsheet\"/\u003e\u003c/a\u003e\n\n## Auth\n\ngooglesheets4 will, by default, help you interact with Sheets as an authenticated Google user. If you don't plan to write Sheets or to read private Sheets, use `gs4_deauth()` to indicate there is no need for a token. See the article [googlesheets4 auth](https://googlesheets4.tidyverse.org/articles/articles/auth.html) for more.\n\nFor this overview, we've logged into Google as a specific user in a hidden chunk.\n\n## Attach googlesheets4\n\n```{r}\nlibrary(googlesheets4)\n```\n\n## Read\n\nThe main \"read\" function of the googlesheets4 package goes by two names, because we want it to make sense in two contexts:\n\n* `read_sheet()` evokes other table-reading functions, like\n `readr::read_csv()` and `readxl::read_excel()`. The `sheet` in this case\n  refers to a Google (spread)Sheet.\n* `range_read()` is the right name according to the\n  [naming convention](https://googlesheets4.tidyverse.org/articles/articles/function-class-names.html)\n  used throughout the googlesheets4 package.\n  \n`read_sheet()` and `range_read()` are synonyms and you can use either one. Here we'll use `read_sheet()`.\n\ngooglesheets4 is [pipe-friendly](https://r4ds.had.co.nz/pipes.html) (and reexports `%\u003e%`), but works just fine without the pipe.\n\nRead from\n\n  * a URL\n  * a Sheet ID\n  * a [`dribble`](https://googledrive.tidyverse.org/reference/dribble.html)\n    produced by the googledrive package, which can lookup by file name\n\nThese all achieve the same thing:\n\n```{r}\n# URL\nread_sheet(\"https://docs.google.com/spreadsheets/d/1U6Cf_qEOhiR9AZqTqS3mbMF3zt2db48ZP5v3rkrAEJY/edit#gid=780868077\")\n\n# Sheet ID\nread_sheet(\"1U6Cf_qEOhiR9AZqTqS3mbMF3zt2db48ZP5v3rkrAEJY\")\n\n# a googledrive \"dribble\"\ngoogledrive::drive_get(\"gapminder\") %\u003e% \n  read_sheet()\n```\n\n*Note: the only reason we can read a sheet named \"gapminder\" (the last example) is because the account we're logged in as has a Sheet named \"gapminder\".*\n\nSee the article [Find and Identify Sheets](https://googlesheets4.tidyverse.org/articles/articles/find-identify-sheets.html) for more about specifying the Sheet you want to address. See the article [Read Sheets](https://googlesheets4.tidyverse.org/articles/articles/find-identify-sheets.html) for more about reading from specific sheets or ranges, setting column type, and getting low-level cell data.\n\n## Write\n\n`gs4_create()` creates a brand new Google Sheet and can optionally send some initial data.\n\n```{r}\n(ss \u003c- gs4_create(\"fluffy-bunny\", sheets = list(flowers = head(iris))))\n```\n\n`sheet_write()` (over)writes a whole data frame into a (work)sheet within a (spread)Sheet.\n\n```{r}\nhead(mtcars) %\u003e% \n  sheet_write(ss, sheet = \"autos\")\nss\n```\n\n`sheet_append()`, `range_write()`, `range_flood()`, and `range_clear()` are more\nspecialized writing functions. See the article [Write Sheets](https://googlesheets4.tidyverse.org/articles/articles/write-sheets.html) for more about writing to Sheets.\n\n```{r include = FALSE}\ngoogledrive::drive_trash(ss)\n```\n\n## Where to learn more\n\n[Get started](https://googlesheets4.tidyverse.org/articles/googlesheets4.html) is a more extensive general introduction to googlesheets4.\n\nBrowse the [articles index](https://googlesheets4.tidyverse.org/articles/index.html) to find articles that cover various topics in more depth.\n\nSee the [function index](https://googlesheets4.tidyverse.org/reference/index.html) for an organized, exhaustive listing.\n\n## Contributing\n\nIf you'd like to contribute to the development of googlesheets4, please read [these guidelines](https://googlesheets4.tidyverse.org/CONTRIBUTING.html).\n\nPlease note that the googlesheets4 project is released with a [Contributor Code of Conduct](https://googlesheets4.tidyverse.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n\n## Privacy\n\n[Privacy policy](https://www.tidyverse.org/google_privacy_policy)\n\n## Context\n\ngooglesheets4 draws on and complements / emulates other packages in the tidyverse:\n\n  * [googlesheets](https://cran.r-project.org/package=googlesheets) is the package that googlesheets4 replaces. Main improvements in googlesheets4: (1) wraps the current, most modern Sheets API; (2) leaves all \"whole file\"\n  operations to googledrive; and (3) uses shared infrastructure for auth and more, from the gargle package. The v3 API wrapped by googlesheets is deprecated. [Starting in April/May 2020](https://workspace.google.com/blog/product-announcements/migrate-your-apps-use-latest-sheets-api),\n  features will gradually be disabled and it's anticipated the API will fully\n  shutdown in September 2020. At that point, the original googlesheets\n  package must be retired.\n  * [googledrive](https://googledrive.tidyverse.org) provides a fully-featured interface to the Google Drive API. Any \"whole file\" operations can be accomplished with googledrive: upload or download or update a spreadsheet, copy, rename, move, change permission, delete, etc. googledrive supports Team Drives.\n  * [readxl](https://readxl.tidyverse.org) is the tidyverse package for reading Excel files (xls or xlsx) into an R data frame. googlesheets4 takes cues from parts of the readxl interface, especially around specifying which cells to read.\n  * [readr](https://readr.tidyverse.org) is the tidyverse package for reading delimited files (e.g., csv or tsv) into an R data frame. googlesheets4 takes cues from readr with respect to column type specification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fgooglesheets4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidyverse%2Fgooglesheets4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fgooglesheets4/lists"}