if (FALSE) {
# Load workbook (create if not existing)
wb <- loadWorkbook("hiddenWorksheet.xlsx", create = TRUE)
# Write a couple of built-in data.frame's into sheets
# with corresponding name
for(obj in c("CO2", "airquality", "swiss")) {
createSheet(wb, name = obj)
writeWorksheet(wb, get(obj), sheet = obj)
}
# Hide sheet 'airquality';
# the sheet may be unhidden by a user from within Excel
# since veryHidden defaults to FALSE
hideSheet(wb, sheet = "airquality")
# Save workbook
saveWorkbook(wb)
# clean up
file.remove("hiddenWorksheet.xlsx")
}
Run the code above in your browser using DataLab