XLConnect (version 1.0.2)

hideSheet-methods: Hiding worksheets in a workbook

Description

(Very) hides the specified worksheets in a '>workbook.

Usage

# S4 method for workbook,character
hideSheet(object, sheet, veryHidden)
# S4 method for workbook,numeric
hideSheet(object, sheet, veryHidden)

Arguments

object

The '>workbook to use

sheet

The name or index of the sheet to hide

veryHidden

If veryHidden = TRUE, the specified sheet is "very" hidden (see note), otherwise it is just hidden. Default is FALSE.

Details

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.

See Also

'>workbook, unhideSheet, isSheetHidden, isSheetVeryHidden, isSheetVisible

Examples

Run this code
# 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")
# }

Run the code above in your browser using DataCamp Workspace