I have been trying to solve this problem, but with no success. Imagine I have a google worksheet called "database". In this worksheet I have a sheet called "Sheet1". And in this sheet I have a table (that starts from A1) with column names "a1", "a2", "a3".
Now, I want to append a new row with values "12", "23", "34". For this I input this code:
library(googlesheets)
worksheet <- gs_title("database")
gs_add_row(ss=worksheet, ws="Sheet1", input = c("12","23","34"))
But when I do this, I get the following error:
Input is too long. Only first 0 elements will be used.
Error: all(lengths == 1L | lengths == n) is not TRUE
Thanks a lot
gs_add_rows only can add rows once the header is available in the google sheet so you need to create the first row or the header information with gs_edit_cells() before you use add_rows.
This is explained in the googlesheets vignette.
Here is a screenshot of the appropriate code from the Vignette
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With