I am using ‘openxlsx’ package in R. ٰI want to add some data in xlsx file. I have used following code to create the workbook and add worksheet in it.
wb=createWorkbook()
addWorksheet(wb,"sheet 1")
writeData(wb,sheet = 1,"From",startCol = 1,startRow = 1)
writeData(wb,sheet = 1,"To",startCol = 2,startRow = 1)
writeData(wb,sheet = 1,"From",startCol = 1,startRow = 2)
writeData(wb,sheet = 1,"From",startCol = 1,startRow = 2)
saveWorkbook(wb,"file.xlsx",overwrite = TRUE)
This code was working well for a long time, But recently, I am facing this error
Error in addWorksheet(wb, "sheet 1") : First argument must be a Workbook.
How this error will be resolved?
I was able to fix this error by disabling XLSX package
detach("package:xlsx", unload = TRUE)