Load data sets from excel
Usage
loadDataSetsFromExcel(
xlsFilePath,
importerConfigurationOrPath,
importAllSheets = FALSE,
sheets = NULL
)Arguments
- xlsFilePath
Path to the excel file with the data
- importerConfigurationOrPath
An object of type
DataImporterConfigurationthat is valid for the excel file or a path to a XML file with stored configuration- importAllSheets
If
FALSE(default), only sheets specified in theimporterConfigurationor in thesheetsparameter will be loaded. IfTRUE, an attempt to load all sheets is performed. If any sheet does not comply with the configuration, an error is thrown. When set toTRUE, this parameter takes priority over thesheetsparameter and configuration sheets.Deprecated: Use
sheets = NULLinstead. This parameter will be removed in version 14.- sheets
Character vector of sheet names to load, or
NULL(default). IfNULLandimportAllSheetsisFALSE, the sheets defined in theimporterConfigurationwill be used. If the configuration has no sheets defined andsheetsisNULLandimportAllSheetsisFALSE, all sheets will be loaded. If a character vector is provided, only the specified sheets will be loaded, overriding any sheets defined in theimporterConfiguration(unlessimportAllSheets = TRUE).
Value
A named set of DataSet objects. The naming is defined by the property
importerConfiguration$namingPattern.
Examples
xlsFilePath <- system.file(
"extdata", "CompiledDataSet.xlsx",
package = "ospsuite"
)
# When sheet is specified, it is automatically added to the configuration
importerConfiguration <- createImporterConfigurationForFile(
xlsFilePath,
sheet = "TestSheet_1"
)
dataSets <- loadDataSetsFromExcel(
xlsFilePath = xlsFilePath,
importerConfigurationOrPath = importerConfiguration
)
# Load specific sheets using the sheets parameter
dataSets <- loadDataSetsFromExcel(
xlsFilePath = xlsFilePath,
importerConfigurationOrPath = importerConfiguration,
sheets = c("TestSheet_1", "TestSheet_2")
)
if (FALSE) { # \dontrun{
# Load all sheets by setting sheets to NULL and no sheets in configuration
importerConfiguration <- createImporterConfigurationForFile(xlsFilePath)
dataSets <- loadDataSetsFromExcel(
xlsFilePath = xlsFilePath,
importerConfigurationOrPath = importerConfiguration,
sheets = NULL
)
} # }