user3683575
user3683575

Reputation: 73

R: googlesheets/gs_upload: Upload to a specific folder

Using the googlesheets package, I am trying to upload a csv to a specific folder in GDrive.

Example:

## Not run: 
write.csv(head(iris, 5), "iris.csv", row.names = FALSE)
gs_upload("iris.csv")

The above will upload the file to my home directory but I need the file to be in a specific directory because I want to create multiple files and be able to share the entire directory.

Alternatively, if there's a way to programmatically move the file after creation, that would be fine too.

Upvotes: 7

Views: 1581

Answers (2)

David Rubinger
David Rubinger

Reputation: 3948

You can use the googledrive package to move the file once it's created:

library(googledrive)
drive_mkdir("iris_folder")  # make folder in home Drive directory
drive_mv(file = "iris", path = "iris_folder/")  # move Sheets file

Upvotes: 3

Suyash Gandhi
Suyash Gandhi

Reputation: 946

Hope this helps. It might not be exactly what you want, but it will definitely serve the ultimate purpose.

http://www.labnol.org/internet/receive-files-in-google-drive/19697/

The link shows how to use a google form to get files. The responses of the forms get stored in a spreadsheet in your google drive. Depending on the location of the response sheet you can store the file in that folder as well.

Upvotes: 0

Related Questions