getSheetPos-methods

0th

Percentile

Querying worksheet position

Queries the position of a worksheet in a '>workbook.

Keywords
methods, utilities
Usage
# S4 method for workbook,character
getSheetPos(object,sheet)
Arguments
object

The '>workbook to use

sheet

The name of the worksheet (character) to query. This argument is vectorized such that multiple worksheets can be queried with one method call.

Value

Returns the position index of the corresponding worksheet. Note that querying a non-existing worksheet results in a 0 index and does not throw an exception!

See Also

'>workbook, setSheetPos, getSheets

Aliases
  • getSheetPos
  • getSheetPos-methods
  • getSheetPos,workbook,character-method
Examples
# NOT RUN {
# mtcars xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", package = "XLConnect")

# Load workbook
wb <- loadWorkbook(demoExcelFile)

# Query worksheet positions for the worksheets 'mtcars2', 'mtcars3',
# 'mtcars' and 'NotThere' (which actually does not exist)
print(getSheetPos(wb, sheet = c("mtcars2", "mtcars3", "mtcars", "NotThere")))
# }
Documentation reproduced from package XLConnect, version 0.2-15, License: GPL-3

Community examples

pearlveera@gmail.com at Jul 2, 2018 XLConnect v0.2-15

demoexcel <- system.file("demoFiles/mtcars.xlsx", package = XLConnect) wb <- loadWorkbook(demoexcel) print(getSheetPos(wb, sheet = "sheet1")