backup_g_sheet | R Documentation |
Creates a local backup of a Google Sheet. It is accessed via googlesheets4::read_sheet()
and written via
readr::write_csv()
or writexl::write_xlsx()
, depending on the file extension of path
.
backup_g_sheet(
g_id,
path,
...,
path_gcp_service_account_key = Sys.getenv("PATH_GCP_KEY_ZDA"),
overwrite = TRUE,
force = FALSE,
quiet = TRUE
)
g_id |
Google Drive file ID. A character scalar. |
path |
Path to the local file backup destination. A character scalar. |
... |
Further arguments passed on to |
path_gcp_service_account_key |
Path to the GCP Service Account Key JSON file. See |
overwrite |
Whether or not to overwrite an already existing file under |
force |
Whether or not to force overwriting the file regardless whether it has changed since the last backup or not. |
quiet |
Whether or not to suppress printing status output from googledrive and googlesheets4 operations. |
backup_g_sheet()
only backs up a single worksheet at once (specified by the optional sheet
argument). If you intend to backup multiple worksheets of the
same Google Sheet, consider using backup_g_file()
in combination with a file type
that supports multiple worksheets like "ods"
or "xlsx"
.
A tibble if the local backup was (over)written, otherwise NULL
, meaning the remote file hasn't deviated from the local backup
since the last run, invisibly.
Other Google Apps functions:
auth_g_drive_gcp()
,
auth_g_sheets_gcp()
,
backup_g_file()
,
g_file_mod_time()
,
upload_to_g_drive()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.