This is a little demo to show how we may view sharing.

library('dplyr')
library('googledrive')
drive_auth("drive-token.rds")
write.table("This is a little demo", "demo.txt")
drive_upload(from = "demo.txt", up_name = "Happy Little Demo")
my_file <- drive_list("Happy Little Demo")$id %>%
  drive_file()

check current permissions

my_file

cool beans - it's private!

change permissions (anyone with link)

all functions that will somehow change the file will output a new file, overwrite the old file with this to avoid confusion

my_file<- my_file %>%
  drive_share(role = "reader", type = "anyone")

Let's see what that did

my_file

Now anyone with the link can view it

change permissions (anyone in the r emo::ji('world'))

my_file <- my_file %>%
  drive_share(role = "reader", type = "anyone", allowFileDiscovery = "true")

Let's see what that did

my_file

make it easier to see

I've added access to the Google Drive file object

my_file$access

share link

you can also output a link to share

drive_share_link(my_file)

clean up

drive_delete(my_file)
rm <- file.remove("demo.txt")


tidyverse/googledrive documentation built on Jan. 14, 2024, 3:44 a.m.