isSheetVisible-methods: Checking if worksheets are visible in a workbook

Description Usage Arguments Details Author(s) See Also Examples

Description

Checks if the specified worksheets are visible in a workbook.

Usage

1
2
3
4
## S4 method for signature 'workbook,character'
isSheetVisible(object,sheet)
## S4 method for signature 'workbook,numeric'
isSheetVisible(object,sheet)

Arguments

object

The workbook to use

sheet

The name or index of the sheet to check

Details

Returns TRUE if the specified named sheet is visible (not hidden and not very hidden), otherwise FALSE. sheet is vectorized such that multiple worksheets can be queried with one method call. An exception is thrown if the specified sheet does not exist.

Author(s)

Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch

See Also

workbook, hideSheet, unhideSheet, isSheetHidden, isSheetVeryHidden

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## Not run: 
# Load workbook (create if not existing)
wb <- loadWorkbook("isSheetVisible.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 'CO2'
hideSheet(wb, sheet = "CO2", veryHidden = FALSE)

# Very hide sheet 'airquality'
hideSheet(wb, sheet = "airquality", veryHidden = TRUE)

# Check if sheet 'swiss' is visible;
# this should obviously return TRUE
isSheetVisible(wb, "swiss")

# Check if sheet 'CO2' is visible;
# this should obviously return FALSE
isSheetVisible(wb, "CO2")

# Check if sheet 'airquality' is visible;
# this should obviously return FALSE
isSheetVisible(wb, "airquality")


# clean up 
file.remove("isSheetVisible.xlsx")

## End(Not run)

XLConnect documentation built on Oct. 1, 2021, 5:06 p.m.