Hello,
I would like to ask how can I connect few excel files using R studio?
I have some files in .xlsx and I would like to connect them in following way:
- loading particular files to R (ex by read.xlsx())
- write down whole files to one file where particular files loaded at the beginning will be in separate sheets
Thank for your replay
FJCC
2
Here is one solution:
library(openxlsx)
FILES <- c("demo.xlsx", "dummy.xlsx", "ExcelOut.xlsx")
FileList <- vector("list", length = length(FILES))
for (i in seq_along(FILES)) {
FileName <- paste0("c:/users/fjcc/Documents/R/Play/", FILES[i])
FileList[[i]] <- read.xlsx(FileName)
}
write.xlsx(FileList, "c:/users/fjcc/Documents/R/Play/MultiSheet.xlsx")
system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.