Skip to content

Update an existing Drive file id with new content ("media" in Drive API-speak), new metadata, or both. To create a new file or update existing, depending on whether the Drive file already exists, see drive_put().


drive_update(file, media = NULL, ..., verbose = deprecated())



Something that identifies the file of interest on your Google Drive. Can be a name or path, a file id or URL marked with as_id(), or a dribble.


Character, path to the local file to upload.


Named parameters to pass along to the Drive API. Has dynamic dots semantics. You can affect the metadata of the target file by specifying properties of the Files resource via .... Read the "Request body" section of the Drive API docs for the associated endpoint to learn about relevant parameters.


[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().


An object of class dribble, a tibble with one row per file.


# Create a new file, so we can update it
x <- drive_example_remote("chicken.csv") %>%
#> Original file:
#>chicken.csv <id: 1VOh6wWbRfuQLxbLg87o58vxJt95SIiZ7>
#> Copied to file:
#>Copy of chicken.csv <id: 1xLm5_OycW3jo_wAeR6V9aZ378-zRLdcs>

# Update the file with new media
x <- x %>%
#> File updated:
#>Copy of chicken.csv <id: 1xLm5_OycW3jo_wAeR6V9aZ378-zRLdcs>

# Update the file with new metadata.
# Notice here `name` is not an argument of `drive_update()`, we are passing
# this to the API via the `...``
x <- x %>%
  drive_update(name = "CHICKENS!")
#> File updated:
#> • 'CHICKENS!' <id: 1xLm5_OycW3jo_wAeR6V9aZ378-zRLdcs>

# Update the file with new media AND new metadata
x <- x %>%
    name = "chicken-poem-again.txt"
#> File updated:
#>chicken-poem-again.txt <id: 1xLm5_OycW3jo_wAeR6V9aZ378-zRLdcs>

# Clean up
#> File deleted:
#>chicken-poem-again.txt <id: 1xLm5_OycW3jo_wAeR6V9aZ378-zRLdcs>