7

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.

Rentrop
  • 20,979
  • 10
  • 72
  • 100

2 Answers2

3

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
David Rubinger
  • 3,580
  • 1
  • 20
  • 29
0

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.

Suyash Gandhi
  • 926
  • 6
  • 24