I would like to write tables to sheets in case there are no data yet and to continue the Rscript in case that there is already data in the sheet.
Similar to the way I add sheets if they don’t exist
Sheet_toevoegen <- function(wb, titel) {
if (length(wb_get_sheet_names(wb)) == 0 || !titel %in% wb_get_sheet_names(wb)) {
wb <- wb_add_worksheet(wb, sheet = titel)
}
return(wb)
}
I would like to write something like this (but wb_get_cell_value doesn’t exist, nor does any equivalent as far as I know
if (is.na(wb_get_cell_value(wb, sheet = "OW10", cols = "B", rows = 2))) {
wb <- wb_add_data_table(
wb = wb,
x = df_OW10,
sheet = "OW10",
dims = "B2",
banded_rows = TRUE,
table_style = "TableStyleLight16"
)
}
New contributor
Tom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.