I have multiple excel file each containing different number of sheet. I want to merge all the sheet of all files except the 1st sheet of each file into a new data frame.
Asked
Active
Viewed 181 times
-4
-
What have you tried so far? Could you provide a minimum reproducible example? Check out this post for some guidance: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – JanLauGe Jul 14 '17 at 09:45
1 Answers
0
If you want to use rbind the columns must have the same name. Ignoring the 1st sheet should be done when calling the frame [-1], a little bit more information would help.

matlabalt
- 40
- 6
-
The columns have same name but i am unable to select all the sheets except sheet 1 of each excel file – Subhashree Jul 14 '17 at 09:55
-
library(xlsReadWrite) sheets <- c("Sheet 1","Sheet 2", etc...) df <- data.frame() for (x in 1:400) df <- rbind(df, read.xls("filename.xls", sheet=sheets[x])) } then you can just do df <- df[-1] and get rid of the first sheet – matlabalt Jul 14 '17 at 09:58