NamedRanges: Functions to manipulate named ranges.

Description Usage Arguments Details Value Author(s) Examples

Description

Functions to manipulate (contiguous) named ranges.

Usage

1
2
3
4
5
getRanges(wb)

readRange(range, sheet, colClasses="character")

createRange(rangeName, firstCell, lastCell)

Arguments

wb

a workbook object as returned by createWorksheet or loadWorksheet.

range

a range object as returned by getRanges.

sheet

a sheet object as returned by getSheets.

rangeName

a character specifying the name of the name to create.

colClasses

the type of the columns supported. Only numeric and character are supported. See read.xlsx2 for more details.

firstCell

a cell object corresponding to the top left cell in the range.

lastCell

a cell object corresponding to the bottom right cell in the range.

Details

These functions are provided for convenience only. Use directly the Java API to access additional functionality.

Value

getRanges returns the existing ranges as a list.

readRange reads the range into a data.frame.

createRange returns the created range object.

Author(s)

Adrian Dragulescu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
file <- system.file("tests", "test_import.xlsx", package = "xlsx")
wb <- loadWorkbook(file)
sheet <- getSheets(wb)[["deletedFields"]]  
ranges <- getRanges(wb)

ranges[[1]]$getNameName()  # get its name

# see all the available java methods that you can call
.jmethods(ranges[[1]])

# create a new named range
firstCell <- sheet$getRow(14L)$getCell(4L)
lastCell  <- sheet$getRow(20L)$getCell(7L)
rangeName <- "Test2"
createRange(rangeName, firstCell, lastCell)

## End(Not run)

xlsx documentation built on June 11, 2018, 9:04 a.m.