knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>", 
  error = TRUE
)

An index of the official example and test Sheets. They are world-readable, so we do gs4_deauth().

library(googlesheets4)

gs4_deauth()

Example Sheets

# the non-interactive wrapper prevents tons of browser tabs opening when I
# have to tinker with this code interactively
sheets <- gs4_examples()
rlang::with_interactive(
  value = FALSE,
  example_urls <- purrr::map_chr(sheets, gs4_browse)
)
links <- glue::glue("[{names(example_urls)}]({unname(example_urls)})")
dat <- tibble::tibble(
  `name (these are links)` = links,
  id = unclass(sheets)
)
knitr::kable(dat)

How to get hold of the example Sheets yourself

gs4_examples() returns a named vector of Sheet IDs. It is also an instance of drive_id, to make good things happen with googledrive.

gs4_examples()

gs4_examples("gap")

gs4_examples("and")

gs4_example() returns exactly one Sheet ID (or errors). It is an instance of drive_id. It is also an instance of sheets_id, which means printing will (try to) reveal current metadata about the Sheet.

gs4_example("chicken")

gs4_example("gap")

Here's a handy snippet to open all the example Sheets in browser tabs.

lapply(gs4_examples(), gs4_browse)

# for tidyversers
gs4_examples() %>% 
  purrr::walk(gs4_browse)

Test Sheets

These are more developer-facing, but it's convenient to do them here too.

sheets <- googlesheets4:::test_sheets()
rlang::with_interactive(
  value = FALSE,
  test_urls <- purrr::map_chr(sheets, gs4_browse)
)
links <- glue::glue("[{names(test_urls)}]({unname(test_urls)})")
dat <- tibble::tibble(
  `name (these are links)` = links,
  id = unclass(sheets)
)
knitr::kable(dat)


jennybc/googlesheets2 documentation built on Dec. 10, 2023, 12:56 a.m.