Skip to content

Publish (or un-publish) native Google files to the web. Native Google files include Google Docs, Google Sheets, and Google Slides. The returned dribble will have extra columns, published and revisions_resource. Read more in drive_reveal().

Usage

drive_publish(file, ..., verbose = deprecated())

drive_unpublish(file, ..., verbose = deprecated())

Arguments

file

Something that identifies the file(s) of interest on your Google Drive. Can be a character vector of names/paths, a character vector of file ids or URLs marked with as_id(), or a dribble.

...

Name-value pairs to add to the API request body (see API docs linked below for details). For drive_publish(), we include publishAuto = TRUE and publishedOutsideDomain = TRUE, if user does not specify other values.

verbose

[Deprecated] This logical argument to individual googledrive functions is deprecated. To globally suppress googledrive messaging, use options(googledrive_quiet = TRUE) (the default behaviour is to emit informational messages). To suppress messaging in a more limited way, use the helpers local_drive_quiet() or with_drive_quiet().

Value

An object of class dribble, a tibble with one row per file. There will be extra columns, published and revisions_resource.

See also

Examples

# Create a file to publish
file <- drive_example_remote("chicken_sheet") %>%
  drive_cp()
#> Original file:
#>chicken_sheet <id: 1SeFXkr3XdzPSuWauzPdN-XnaryOYmZ7sFiUF5t-wSVU>
#> Copied to file:
#>Copy of chicken_sheet
#>   <id: 1k0u0hGcU6KD3q4MJSdSaTy-RLC6_mxbn4wsPNfn6MoY>

# Publish file
file <- drive_publish(file)
#> File now published:
#>Copy of chicken_sheet
#>   <id: 1k0u0hGcU6KD3q4MJSdSaTy-RLC6_mxbn4wsPNfn6MoY>
file$published
#> [1] TRUE

# Unpublish file
file <- drive_unpublish(file)
#> File now NOT published:
#>Copy of chicken_sheet
#>   <id: 1k0u0hGcU6KD3q4MJSdSaTy-RLC6_mxbn4wsPNfn6MoY>
file$published
#> [1] FALSE

# Clean up
drive_rm(file)
#> File deleted:
#>Copy of chicken_sheet
#>   <id: 1k0u0hGcU6KD3q4MJSdSaTy-RLC6_mxbn4wsPNfn6MoY>