I've been using the openxlsx package to format different excel files (ie. highlighting a row based on a condition).
I created two workbooks with this package and each workbook is formatted differently. Now, I am trying to combine these two workbooks into a single excel file where these individual workbooks are tabs. Is there a way to do that? I know you can do it with multiple dataframes, but if I do that, then I lose my formatting.
For example, I tried this:
wb <- createWorkbook()
addWorksheet(wb, sheetName="data")
writeData(wb, sheet="data", x=data)
wb2 <- createWorkbook()
addWorksheet(wb2, sheetName="data2")
writeData(wb2, sheet="data2", x=data2)
write.xlsx(wb, file = "combined.xlsx", sheetName="data", row.names=FALSE)
write.xlsx(wb2,file = "combined.xlsx", sheetName="data2", append = TRUE, row.names=FALSE)
but it seems to only work for dataframes.