Skip to content

Finds your Google Sheets. This is a very thin wrapper around googledrive::drive_find(), that specifies you want to list Drive files where type = "spreadsheet". Therefore, note that this will require auth for googledrive! See the article Using googlesheets4 with googledrive if you want to coordinate auth between googlesheets4 and googledrive. This function will emit an informational message if you are currently logged in with both googlesheets4 and googledrive, but as different users.

Usage

gs4_find(...)

Arguments

...

Arguments (other than type, which is hard-wired as type = "spreadsheet") that are passed along to googledrive::drive_find().

Value

An object of class dribble, a tibble with one row per file.

Examples

# see all your Sheets
gs4_find()
#> # A dribble: 9 × 3
#>   name               id                                       drive_reso…¹
#>   <chr>              <drv_id>                                 <list>      
#> 1 geological-canary  13fmUp01xitQrPvgw7LWDXNMHiMewxHnPuYHaig… <named list>
#> 2 blubbery-lobo      1foTYXQEknymPpyug1xWOq7ituJ-ywLCaTEHaF2… <named list>
#> 3 bacciform-booby    15WqCxHBCjY4P_i6-uTL9rUBgpcHRKQFrqheRSS… <named list>
#> 4 childsafe-squid    1uGu_BHwialVz6okcuO5kRgLhaprClnzq5Orgc9… <named list>
#> 5 fiery-hart         18KiiL2AGkL9nTkjHdOXGmeUQzqnOLqWnnOIEnW… <named list>
#> 6 chicken-sheet      1StV8oqHa0SVo58ztLGPH5mDMMHIBsiF6VO5GUJ… <named list>
#> 7 releasable-rooster 1cMnXxJE-B55ZSyPzvv3yyXv2hZ0vu45Tp8LJV2… <named list>
#> 8 eonian-atlasmoth   1BMEsbT_kSfV4zBl6si7HZXuda6kThG27vHuYc4… <named list>
#> 9 gapminder          1ksUQqF_K5yKbJr_uWVnFVZhVuxwMyZCvK6MZOE… <named list>
#> # … with abbreviated variable name ¹​drive_resource

# see 5 Sheets, prioritized by creation time
x <- gs4_find(order_by = "createdTime desc", n_max = 5)
x
#> # A dribble: 5 × 3
#>   name              id                                        drive_reso…¹
#>   <chr>             <drv_id>                                  <list>      
#> 1 geological-canary 13fmUp01xitQrPvgw7LWDXNMHiMewxHnPuYHaig2… <named list>
#> 2 blubbery-lobo     1foTYXQEknymPpyug1xWOq7ituJ-ywLCaTEHaF2y… <named list>
#> 3 bacciform-booby   15WqCxHBCjY4P_i6-uTL9rUBgpcHRKQFrqheRSSO… <named list>
#> 4 childsafe-squid   1uGu_BHwialVz6okcuO5kRgLhaprClnzq5Orgc9B… <named list>
#> 5 fiery-hart        18KiiL2AGkL9nTkjHdOXGmeUQzqnOLqWnnOIEnWY… <named list>
#> # … with abbreviated variable name ¹​drive_resource

# hoist the creation date, using other packages in the tidyverse
# x %>%
#   tidyr::hoist(drive_resource, created_on = "createdTime") %>%
#   dplyr::mutate(created_on = as.Date(created_on))