Currently, I'm working with Excel workbooks for > 15 sheets. I use the following sequence:
#libraries
library(data.table)
library(openxlsx)
#load excel file
wb <- loadWorkbook("Data.xlsx")
#write sheets into a list of data frames
name <- names(wb)
df <- list()
for (i in 1:length(name)){
d <- lapply(i, function(i) readWorkbook(wb, sheet = name[i], startRow = 1, colNames = TRUE, rowNames = FALSE, detectDates = TRUE, skipEmptyRows = TRUE, skipEmptyCols = TRUE, rows = NULL, cols = NULL, check.names = FALSE, namedRegion = NULL, na.strings = "NA", fillMergedCells = FALSE))
df <- append(df, d)
}
#assign names to columns
names(df) <- name
#merge DFs into one list
DT <- rbindlist(df)
Now, I've been working mostly with very small data sets, so performance is not an issue. However, I was wondering if there's an easier way to perform this, in case I'm working with big data sets.
Thanks a lot for your input already.