I've got hundreds of Excel files with varying quantities of sheets within said files. I want to combine all these Excel files and sheets into one data frame. Lucky for me, all the sheets are in the same format (they're a template filled out by customers and uploaded to a central repository).
Let's simulate these Excel files and sheets with the code below:
library(tidyverse)
library(openxlsx)
library(readxl)
write.xlsx(list(iris, iris * 2, iris * 3), "three_sheets.xlsx")
write.xlsx(list(iris, iris / 2), "two_sheets.xlsx")
How would I use R purrr to combine these files and sheets into one data frame? And can I mutate a column to identify which file/sheet each row comes from? If purrr isn't the best choice for this type of problem feel free to point out other solutions.