protectWorkbook: Protect a workbook from modifications

Description Usage Arguments Author(s) Examples

Description

Protect or unprotect a workbook from modifications by the user in the graphical user interface. Replaces an existing protection.

Usage

1
2
protectWorkbook(wb, protect = TRUE, password = NULL,
  lockStructure = FALSE, lockWindows = FALSE)

Arguments

wb

A workbook object

protect

Whether to protect or unprotect the sheet (default=TRUE)

password

(optional) password required to unprotect the workbook

lockStructure

Whether the workbook structure should be locked

lockWindows

Whether the window position of the spreadsheet should be locked

Author(s)

Reinhold Kainhofer

Examples

1
2
3
4
5
6
7
wb <- createWorkbook()
addWorksheet(wb, "S1")
protectWorkbook(wb, protect = TRUE, password = "Password", lockStructure = TRUE)
saveWorkbook(wb, "WorkBook_Protection.xlsx")
# Remove the protection
protectWorkbook(wb, protect = FALSE)
saveWorkbook(wb, "WorkBook_Protection_unprotected.xlsx")

awalker89/openxlsx documentation built on May 11, 2019, 4:09 p.m.