# NOT RUN {
wb <- createWorkbook()
addWorksheet(wb, "S1")
protectWorkbook(wb, protect = TRUE, password = "Password", lockStructure = TRUE)
# }
# NOT RUN {
saveWorkbook(wb, "WorkBook_Protection.xlsx", overwrite = TRUE)
# }
# NOT RUN {
# Remove the protection
protectWorkbook(wb, protect = FALSE)
# }
# NOT RUN {
saveWorkbook(wb, "WorkBook_Protection_unprotected.xlsx", overwrite = TRUE)
# }
Run the code above in your browser using DataLab