To add a new worksheet in an existing spreadsheet:
require(googlesheets)
#first get the existing spreadsheet
existing_spreadsheet <- gs_title("title")
#Then add the new worksheet to the existing sheet
gs_ws_new(existing_spreadsheet
, ws_title = "worksheet title" #make sure it doesn't exist already
, input = your_input #data.frame or data.table
, trim = TRUE #optional if you want your worksheet trimed
)
I haven't been able to find a direct way to overwrite a worksheet in an existing spreadsheet myself. So i've had to delete the existing worksheet and add it again as a new worksheet.
#first delete the existing worksheet
existing_spreadsheet <- gs_ws_delete(existing_spreadsheet, "work sheet title you want updated")
# Then add the newworksheet with new data
gs_ws_new(existing_spreadsheet
, ws_title = "worksheet title"
, input = your_new_data #data.frame or data.table
, trim = TRUE #optional if you want your worksheet trimed
)