I have hundreds of spreadsheets with thousands rows in a folder and need to group them into a single worksheet. I already managed to do this, but I ended up copying the first line that corresponds to the header and would like to delete those lines, leaving only the first line (which is supposed to be a header).
My code to merge these files in a single df is:
setwd("~/Desktop/R studies/base1_rawsheets") #folder with spreadsheets
library(readxl)
data.files = list.files()
df <- readxl::read_excel(data.files[1], sheet=1) #reading the first file of list
for (file in data.files[-1]){
newFile <- readxl::read_excel(file, sheet=1)
df <- merge(df, newFile, all=T)
}
Thanks a lot for any help!
p.s.: The code I used was adapted from that solution here How to read multiple excel sheets in R programming?