We need to create a list, importing several XLSX
files. These files have a pattern in their names, each one has the same first characters, but different numbers based on dates:
Opca202201
Opca202202
etc
Problm is: these files have multiple sheets, and the the name and the position of the sheet we need changes from file to file. They does have a pattern in the sheet name, such as:
Dados08777
Dados65423
etc
The word Dados
always remain in the sheet.
We tried to use lapply()
, pattern()
and read.xlsx()
, but we don't know how to find the exact sheet.
setwd("H:/Bases/Teste")
file.list <- list.files(pattern='*')
df.list <- lapply(file.list, read_excel)
df = bind_rows(df.list)
Could someone help us?
Aucun commentaire:
Enregistrer un commentaire