Reputation: 553
I am attempting to automatically update a Google Sheets with R. When I run the gs_edit_cells()
command I get the error:
Error: inherits(ss, "googlesheet") is not TRUE
I am not really understanding the error, or at least I might be misunderstanding it. The code I am running is:
gs_edit_cells(ss = 'Stats', ws = 1, input = mydf, anchor = "A1", byrow = FALSE,
col_names = FALSE, trim = TRUE, verbose = TRUE)
where mydf
is a dataframe (of reasonable dimensions), and 'Stats'
is the name of the Google Sheet. I have attempted with all other identifying fields retrieved from the gs_ls()
command, e.g. sheet_key
, ws_feed
, URL, etc.
Thanks in advance for any help.
Upvotes: 4
Views: 1889
Reputation: 8377
I expand my comment, with many of the googlesheets::
functions, you are supposed to provide a ss
argument which is defined as:
ss : a registered Google spreadsheet, i.e. a googlesheet object
So ss
cannot be a string like 'stats', it must be an object of class googlesheet
, typically created with the gs_title
function. Try this:
mysheet <- gs_title("Stats")
gs_edit_cells(ss = mysheet, ws = 1, input = mydf, anchor = "A1", byrow = FALSE,
col_names = FALSE, trim = TRUE, verbose = TRUE)
Upvotes: 6