workbook .## S3 method for class 'workbook,numeric':
readTable(object, sheet, table, header, rownames, colTypes, forceConversion,
dateTimeFormat, check.names, useCachedValues, keep, drop, simplify, readStrategy)
## S3 method for class 'workbook,character':
readTable(object, sheet, table, header, rownames, colTypes, forceConversion,
dateTimeFormat, check.names, useCachedValues, keep, drop, simplify, readStrategy)workbook to usetableheader specifies if the first row
should be interpreted as column names. The default value is TRUE.numeric) or name (character) of column that
should be used as row names. The corresponding column will be removed from the data
set. Defaults to NULL which means that no row names are applied.character
vector of the corresponding type names (see XLC; XLC$DATA_TYPE.>). You
may also use R class names such as <logical specifying if conversions to less generic types should be
forced. Defaults to FALSE meaning that if a column is specified
to be of a certain type via the colTypes argument and a more generic type is detecgetOption("XLConnect.dateTimeFormat"). This should be a POSIX format specifier according
to strptime although not all speclogical specifying if column names of the resulting data.frame
should be checked to ensure that they are syntactically valid valid variable names and are not
duplicated. See the check.names argument of logical specifying whether to read cached formula results from the
workbook instead of re-evaluating them. This is particularly helpful in cases for reading data
produced by Excel features not supported in XLConnect like references to exkeep or drop, but not both at the same time.
Defaults to NULL. If a vector is passed as argument, it will be keep or drop, but not both at the same time.
Defaults to NULL. If a vector is passed as argument, it will blogical specifying if the result should be simplified, e.g. in case the data.frame
would only have one row or one column (and data types match). Simplifying here is identical to calling unlist
on the otherwise recharacter specifying the reading strategy to use. Currently supported strategies are:
"default"(default): Can handle all supported data types incl. date/time values and can deal
directly with missing value identifierworkbook ,
readNamedRegion,
readWorksheet,
writeNamedRegion,
writeWorksheet,
readNamedRegionFromFile,
onErrorCell# mtcars xlsx file from demoFiles subfolder of package XLConnect
demoExcelFile <- system.file("demoFiles/mtcars.xlsx", package = "XLConnect")
# Load workbook
wb <- loadWorkbook(demoExcelFile)
# Read table 'MtcarsTable' from sheet 'mtcars_table'
data <- readTable(wb, sheet = "mtcars_table", table = "MtcarsTable")Run the code above in your browser using DataLab