Functions to manipulate (contiguous) named ranges.
These functions are provided for convenience only. Use directly the Java API to access additional functionality.
createRange(rangeName, firstCell, lastCell) getRanges(wb) readRange(range, sheet, colClasses = "character")
rangeName |
a character specifying the name of the name to create. |
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. |
wb |
a workbook object as returned by |
range |
a range object as returned by |
sheet |
a sheet object as returned by |
colClasses |
the type of the columns supported. Only |
getRanges
returns the existing ranges as a list.
readRange
reads the range into a data.frame.
createRange
returns the created range object.
Adrian Dragulescu
file <- system.file("tests", "test_import.xlsx", package = "xlsx") wb <- loadWorkbook(file) sheet <- getSheets(wb)[["deletedFields"]] ranges <- getRanges(wb) # the call below fails on cran tests for MacOS. You should see the # FAQ: https://code.google.com/p/rexcel/wiki/FAQ #res <- readRange(ranges[[1]], sheet, colClasses="numeric") # read it ranges[[1]]$getNameName() # get its name # see all the available java methods that you can call rJava::.jmethods(ranges[[1]]) # create a new named range firstCell <- sheet$getRow(14L)$getCell(4L) lastCell <- sheet$getRow(20L)$getCell(7L) rangeName <- "Test2" # same issue on MacOS #createRange(rangeName, firstCell, lastCell)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.