How do I modify an existing a sheet in an Excel Workbook using Openxlsx package in R?
Try this:
wb <- loadWorkbook("Revenue.xlsx")
writeData(wb, sheet = "Data", Rev_4, colNames = F)
saveWorkbook(wb,"Revenue.xlsx",overwrite = T)
You need to load the complete workbook, then modify its data and then save it to disk. With writeData
you can also specify the starting row and column. And you could also modify other sections before saving to disk.