View source: R/drive_download.R
drive_download | R Documentation |
This function downloads a file from Google Drive. Native Google file types, such as Google Docs, Google Sheets, and Google Slides, must be exported to a conventional local file type. This can be specified:
explicitly via type
implicitly via the file extension of path
not at all, i.e. rely on the built-in default
To see what export file types are even possible, see the Drive API documentation
or the result of drive_about()$exportFormats
. The returned dribble
includes a local_path
column.
drive_download(
file,
path = NULL,
type = NULL,
overwrite = FALSE,
verbose = deprecated()
)
An object of class dribble
, a tibble with one row per file.
Download files, in the Drive API documentation.
# Target one of the official example files
(src_file <- drive_example_remote("chicken_sheet"))
# Download Sheet as csv, explicit type
downloaded_file <- drive_download(src_file, type = "csv")
# See local path to new file
downloaded_file$local_path
# Download as csv, type implicit in file extension
drive_download(src_file, path = "my_csv_file.csv")
# Download with default name and type (xlsx)
drive_download(src_file)
# Clean up
unlink(c("chicken_sheet.csv", "chicken_sheet.xlsx", "my_csv_file.csv"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.