I have over 100 excel files, each with 50 sheets. I am trying to read one sheet from each file. The location and name of the sheet that I am trying to read varies in each file.
However, the name of sheet (that I am trying to read) in each file always contains the word "validate". So, I am trying to read the sheet containing the word validate from 100 files. This requires me to use the regular expression (like "grepl" to choose the sheet containing the word "validate"). I want to know whether this is possible.
To my knowledge, read_excel and xlsx packages do not allow this. I want something like following:
library(xlsx2)
files<-paste0("file",1:100)
lapply(files, function(i){
read.xlsx2(
paste0(i,".xlsx"), sheetName = grep("validate", ??,value=TRUE))})