Read excel dynamically

Hi all,
I have a doubt I want to read an excel file which is saved in a folder and the file name has date and time. I mean the file name is dynamic.

Can anyone help me to read that excel file. I need to read only one 1 excel file.

Thank you in advance

Hi @honey.123.631

Try this-

Directory.GetFiles(folderPath, “*.xlsx”)
.OrderByDescending(Function(f) File.GetLastWriteTime(f))


hi @honey.123.631

Does that file name have anything static inside it?
If so you can retrieve that

Directory.GetFiles(folderPath, “statictext.xlsx”)

That way you’ll get the files.
Now if you want to get the one which was updated last then you can add as @Nitya1 suggested.

Directory.GetFiles(folderPath, “statictext.xlsx”).OrderByDescending(Function(f) File.GetLastWriteTime(f)).FirstOrDefault()


Thank you but should we put . tostring in the last