getLastRow-methods: Querying the last (non-empty) row on a worksheet

Description Usage Arguments Details Author(s) See Also Examples

Description

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

Usage

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

Arguments

object

The workbook to use

sheet

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

Details

Returns the numeric index of the last non-empty row in the specified worksheet.

Author(s)

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

See Also

workbook

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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
getLastRow(wb, "mtcars")

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

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

Example output

Loading required package: XLConnectJars
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed
XLConnect 0.2-12 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
    Codec),
  Stephen Colebourne [ctb, cph] (Joda-Time Java library),
  Graph Builder [ctb, cph] (Curvesapi Java library)
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com
ZoneInfo: /usr/share/javazi/ZoneInfoMappings (Permission denied)
mtcars 
    33 
mtcars2 
     41 
mtcars3 
     49 
Warning message:
system call failed: Cannot allocate memory 

XLConnect documentation built on April 6, 2018, 1:03 a.m.