Created
September 13, 2016 17:14
-
-
Save andrewbtran/343683bd5259de7d4e7b0b05e877e799 to your computer and use it in GitHub Desktop.
Importing folder of Excel files, combining, exporting as CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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