hideSheet-methods | R Documentation |
(Very) hides the specified worksheets in a workbook
.
## S4 method for signature 'workbook,character'
hideSheet(object, sheet, veryHidden)
## S4 method for signature 'workbook,numeric'
hideSheet(object, sheet, veryHidden)
object |
The |
sheet |
The name or index of the sheet to hide |
veryHidden |
If |
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.
Note that hidden worksheets can be unhidden by users directly within
Excel via standard functionality. Therefore Excel knows the concept
of "very hidden" worksheets. These worksheets cannot be unhidden with
standard Excel functionality but need programatic intervention to be
made visible.
Also note that in case the specified worksheet to hide is the
currently active worksheet, then hideSheet
tries to set the
active worksheet to the first non-hidden (not hidden and not very
hidden) worksheet in the workbook. If there is no such worksheet,
hideSheet
will throw an exception.
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
workbook
, unhideSheet
,
isSheetHidden
, isSheetVeryHidden
,
isSheetVisible
## Not run:
# 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")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.