Closed deschen1 closed 1 year ago
sheet_append()
is absolutely designed for the narrow case of adding rows to an existing table, i.e. without making any change to the "schema". So adding columns definitely falls outside the scope of sheet_append()
.
Understood. Any chance for creating an additional function then for the (probably very frequent) use case of adding rows/columns at the same time?
No near term plans. I do keenly feel that there's a whole missing toolkit for various types of modification of a data frame, including the one you're talking about, but it's also a big project. There's a lot to think about in terms of how to wire this up into the Sheets API and also how it should "feel" in R. For the moment, googlesheets4 is definitely focused on the "write an entire data rectangle at once" use case, with a bit of support for adjacent moves, like appending a row.
sheet_append
currently is overly strict when appending new rows to an existing sheet, i.e. the appended data must not have more column than the existing sheet. Which makes the whole adding of new rows cumbersome, because what someone currently needs to do is:range_write
,The solution (if supported by the Google API) would be maybe an optional parameter
strict = TRUE/FALSE
, indicating what should happen when the new row has more columns than the existing sheet (E.g. error as of now or add the column).If adding additional columns is not supported by the Google API, then it would be preferable if
sheet_append
could do the above mentioned workaround under the hood.Note: it is not an option in this use case to simply re-write/overwrite the entire sheet, because it might contain content online that is not part of the sheet that is upload (e.g. a user might have added a comment or applied some formats).