I am trying to import multiple excel workbook files, each of which is comprised of 6 sheets, and concatenate them into a single R data.frame. I have multiple workbook files (wb1.xlsx), each of which is made up of 6 sheets (1, 2, 3, 4, 5 and 6). Each sheet has the same name in each workbook (e.g. in wb1.xlsx and wb2.xlsx the first sheet in both files is called sheet 1). In addition each sheet has the same set of headers headers in every other sheet and in every other workbook (e.g. Sheet 1 in wb1 and sheet 2 in wb2 have the same headers).
I have tried using the import_list function from the rio package:
library(rio)
DF <- import_list(dir(pattern = ".xlsx"), rbind = TRUE)
However, this only imports the first sheet of each excel workbook. I want to import every sheet from the excel workbook files.
In addition I would like to create a column in the data frame which contains the name of the excel workbook file from which elements were imported (e.g. a column for all elements imported from wb1.xlsx called wb1.xlsx).