Skip to content

Instantly share code, notes, and snippets.

@andrewbtran
Created September 13, 2016 17:14
Show Gist options
  • Save andrewbtran/343683bd5259de7d4e7b0b05e877e799 to your computer and use it in GitHub Desktop.
Save andrewbtran/343683bd5259de7d4e7b0b05e877e799 to your computer and use it in GitHub Desktop.
Importing folder of Excel files, combining, exporting as CSV
# set wd() to folder with Excel files
# install.packages("readxl")
library(readxl)
excel_list <- list.files()
for (i in 1:length(excel_list)) {
e_file <- excel_list[i]
if (i == 1) {
e_file_combined <- read_excel(e_file, sheet=1)
} else {
e_file_combined <- rbind(e_file_combined, read_excel(e_file, sheet=1))
}
}
write.csv(e_file_combined, "combined_excel_sheets.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment