0

I am trying to add data to the second worksheet of an existing Google Sheet, but the R googlesheet package does not seem to recognise that there are more than one worksheets already in the spreadsheet. Here are the interactive commands along with their responses.

gs_upload("log08.txt")
# File uploaded to Google Drive:
# log08.txt
# As the Google Sheet named:
# log08

gobj<-gs_title("log08")
# Sheet successfully identified: "log08"

gs_ws_new(ss = gobj,ws_title = "expanded")
# Worksheet "expanded" added to sheet "log08".
# Worksheet dimensions: 1000 x 26.

gs_edit_cells(ss = gobj,ws = 2,input = data_table2)
# Error: Spreadsheet only contains 1 worksheets.
tehhowch
  • 9,645
  • 4
  • 24
  • 42
Lazarus Thurston
  • 1,197
  • 15
  • 33

1 Answers1

0

Figured out you have to refresh the gs handle. Using gs_title or gs_key register the google sheet file again and then use gs_edit_cells with the newly added worksheet and it will work.

Lazarus Thurston
  • 1,197
  • 15
  • 33