getLastColumn-methods {XLConnect}R Documentation

Querying the last (non-empty) column on a worksheet

Description

Queries the last (non-empty) column on a worksheet.

Usage

## S4 method for signature 'workbook,character'
getLastColumn(object,sheet)
## S4 method for signature 'workbook,numeric'
getLastColumn(object,sheet)

Arguments

object

The workbook to use

sheet

The name or index of the sheet of which to query the last column

Details

Returns the (1-based) numeric index of the last non-empty column in the specified worksheet.

Author(s)

Martin Studer
Mirai Solutions GmbH http://www.mirai-solutions.com

See Also

workbook

Examples

# mtcars xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", package = "XLConnect")

# Load workbook
wb <- loadWorkbook(demoExcelFile)

# Query the last row of the 'mtcars' worksheet
getLastColumn(wb, "mtcars")

# Query the last row of the 'mtcars2' worksheet
getLastColumn(wb, "mtcars2")

# Query the last row of the 'mtcars3' worksheet
getLastColumn(wb, "mtcars3")

[Package XLConnect version 0.2-7 Index]