This function uploads a data.frame as a CSV file to Google Drive. If the name of the spreadsheet exists already, then it gets updated. Otherwise it uploads it for the first time. Unlike using drive_upload(overwrite = TRUE) directly, this function allows you to keep the sharing and publishing settings of a spreadsheet if it exists already.

googledrive_csv(df, sheet_name)

Arguments

df

A data.frame() to upload.

sheet_name

A character(1) vector with the name of the Google Drive spreadsheet that will be updated (or created if it doesn't exist).

Value

A one row table with the googledrive information for the file that was uploaded.

Author

Leonardo Collado-Torres

Examples


if (googledrive::drive_has_token()) {
    ## You'll need to have access to Google Drive through
    ## googledrive::drive_auth() set up.


    ## Upload a table to google drive
    googledrive_csv(mtcars, paste(Sys.Date(), "jaffelab::googledrive_csv() example"))
}