qprotect: Protect one ore more columns of a worksheet

View source: R/protect.R

qprotectR Documentation

Protect one ore more columns of a worksheet

Description

Wrapper to openxlsx::protectWorksheet with additional argument cols to enable protection to be limited to specific columns.

In practice, protection is first applied to the entire worksheet, and then subsequently columns not selected for protection (if any) are unlocked one by one. This unlock step (when relevant) also requires a row specification, which by default we limit to the range of the current data. Thus, in 'unprotected' columns within protected worksheets, rows beyond the range of the data will remain protected. As a hack to work around this, the user can specify a 'buffer' of additional empty rows to unprotect within each non-protected column (e.g. to allow further data entry).

Usage

qprotect(
  password = NULL,
  cols = everything(),
  row_buffer = 0L,
  protect = TRUE,
  lockSelectingLockedCells = FALSE,
  lockSelectingUnlockedCells = FALSE,
  lockFormattingCells = FALSE,
  lockFormattingColumns = FALSE,
  lockFormattingRows = FALSE,
  lockInsertingColumns = TRUE,
  lockInsertingRows = TRUE,
  lockInsertingHyperlinks = FALSE,
  lockDeletingColumns = TRUE,
  lockDeletingRows = TRUE,
  lockSorting = FALSE,
  lockAutoFilter = FALSE,
  lockPivotTables = NULL,
  lockObjects = NULL,
  lockScenarios = NULL
)

Arguments

password

(optional) password required to unprotect the worksheet

cols

Tidy-selection specifying the columns that protection should apply to. Defaults to dplyr::everything to select all columns.

row_buffer

The number of additional rows (beyond the range of the current data) to unprotect within columns not specified in argument cols. See explanation in Description. Defaults to 0.

protect

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

lockSelectingLockedCells

Whether selecting locked cells is locked

lockSelectingUnlockedCells

Whether selecting unlocked cells is locked

lockFormattingCells

Whether formatting cells is locked

lockFormattingColumns

Whether formatting columns is locked

lockFormattingRows

Whether formatting rows is locked

lockInsertingColumns

Whether inserting columns is locked

lockInsertingRows

Whether inserting rows is locked

lockInsertingHyperlinks

Whether inserting hyperlinks is locked

lockDeletingColumns

Whether deleting columns is locked

lockDeletingRows

Whether deleting rows is locked

lockSorting

Whether sorting is locked

lockAutoFilter

Whether auto-filter is locked

lockPivotTables

Whether pivot tables are locked

lockObjects

Whether objects are locked

lockScenarios

Whether scenarios are locked


epicentre-msf/qxl documentation built on March 26, 2024, 6:33 p.m.