Lucy D’Agostino McGowan 5/3/2017
Push a table into a Sheet.
Try to read it as another user Assume you even have the key. You will fail.
Now, as the user who owns the Sheet, publish it.
Now, as the other user, try again to read it via googlesheets. You should succeed.
drive_auth("drive-token.rds")
## Auto-refreshing stale OAuth token.
write_csv(chickwts, "chickwts.csv")
drive_chickwts <- drive_upload("chickwts.csv", type = "spreadsheet")
## File uploaded to Google Drive:
## chickwts.csv
## As the Google spreadsheet named:
## chickwts
drive_check_publish(drive_chickwts)
## The latest revision of the Google Drive file 'chickwts' is not published.
url <- drive_share_link(drive_chickwts)
url
## [1] "https://docs.google.com/spreadsheets/d/1dES65Ur8AcYSS4JnnMGRp7A3wVJEHKMvBG8M60U4m0A/edit?usp=drivesdk"
drive_chickwts
## File name: chickwts
## File owner: tidyverse testdrive
## File type: spreadsheet
## Last modified: 2017-05-22
## Access: Shared with specific people.
key <- drive_chickwts$id
gs_auth("sheets-token.rds")
try(gs_url(url, visibility = "private", lookup = FALSE))
## Sheet-identifying info appears to be a browser URL.
## googlesheets will attempt to extract sheet key from the URL.
## Putative key: 1dES65Ur8AcYSS4JnnMGRp7A3wVJEHKMvBG8M60U4m0A
## Worksheets feed constructed with private visibility
geterrmessage()
## [1] "Error in function_list[[k]](value) : Forbidden (HTTP 403).\n"
drive_chickwts <- drive_publish(drive_chickwts)
## You have changed the publication status of 'chickwts'.
drive_check_publish(drive_chickwts)
## The latest revision of Google Drive file 'chickwts' is published.
gs_url(url, lookup = FALSE)
## Sheet-identifying info appears to be a browser URL.
## googlesheets will attempt to extract sheet key from the URL.
## Putative key: 1dES65Ur8AcYSS4JnnMGRp7A3wVJEHKMvBG8M60U4m0A
## Worksheets feed constructed with public visibility
## Spreadsheet title: chickwts
## Spreadsheet author: tidyverse.testdrive
## Date of googlesheets registration: 2017-05-22 21:45:25 GMT
## Date of last spreadsheet update: 2017-05-22 21:45:21 GMT
## visibility: public
## permissions: rw
## version: new
##
## Contains 1 worksheets:
## (Title): (Nominal worksheet extent as rows x columns)
## chickwts: 1000 x 26
##
## Key: 1dES65Ur8AcYSS4JnnMGRp7A3wVJEHKMvBG8M60U4m0A
## Browser URL: https://docs.google.com/spreadsheets/d/1dES65Ur8AcYSS4JnnMGRp7A3wVJEHKMvBG8M60U4m0A/
check again that the access is still just "Shared with specific people."
drive_chickwts$access
## [1] "Shared with specific people."
#drive_delete(drive_chickwts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.