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_resource
#>   <chr>              <drv_id>                               <list>        
#> 1 geological-canary  13fmUp01xitQrPvgw7LWDXNMHiMewxHnPuYHa… <named list>  
#> 2 blubbery-lobo      1foTYXQEknymPpyug1xWOq7ituJ-ywLCaTEHa… <named list>  
#> 3 bacciform-booby    15WqCxHBCjY4P_i6-uTL9rUBgpcHRKQFrqheR… <named list>  
#> 4 childsafe-squid    1uGu_BHwialVz6okcuO5kRgLhaprClnzq5Org… <named list>  
#> 5 fiery-hart         18KiiL2AGkL9nTkjHdOXGmeUQzqnOLqWnnOIE… <named list>  
#> 6 chicken-sheet      1StV8oqHa0SVo58ztLGPH5mDMMHIBsiF6VO5G… <named list>  
#> 7 releasable-rooster 1cMnXxJE-B55ZSyPzvv3yyXv2hZ0vu45Tp8LJ… <named list>  
#> 8 eonian-atlasmoth   1BMEsbT_kSfV4zBl6si7HZXuda6kThG27vHuY… <named list>  
#> 9 gapminder          1ksUQqF_K5yKbJr_uWVnFVZhVuxwMyZCvK6MZ… <named list>  

# 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_resource
#>   <chr>             <drv_id>                                <list>        
#> 1 geological-canary 13fmUp01xitQrPvgw7LWDXNMHiMewxHnPuYHai… <named list>  
#> 2 blubbery-lobo     1foTYXQEknymPpyug1xWOq7ituJ-ywLCaTEHaF… <named list>  
#> 3 bacciform-booby   15WqCxHBCjY4P_i6-uTL9rUBgpcHRKQFrqheRS… <named list>  
#> 4 childsafe-squid   1uGu_BHwialVz6okcuO5kRgLhaprClnzq5Orgc… <named list>  
#> 5 fiery-hart        18KiiL2AGkL9nTkjHdOXGmeUQzqnOLqWnnOIEn… <named list>  

# 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))