Last chance! 50% off unlimited learning
Sale ends in
(Very) hides the specified worksheets in a workbook
.
# S4 method for workbook,character
hideSheet(object, sheet, veryHidden)
# S4 method for workbook,numeric
hideSheet(object, sheet, veryHidden)
The workbook
to use
The name or index of the sheet to hide
If veryHidden = TRUE
, the specified sheet
is "very" hidden
(see note), otherwise it is just hidden. Default is FALSE
.
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
The arguments sheet
and veryHidden
are vectorized such
that multiple worksheets can be (very) hidden with one method call. An
exception is thrown if the specified sheet
does not exist.
workbook
, unhideSheet
,
isSheetHidden
, isSheetVeryHidden
,
isSheetVisible
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