Excel files connection


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

Here is one solution:

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")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.