Opening file with different name each day

excel
studio

#1

How can I get uipath to identify and open an excel file that will be saved each day with that day’s date in the file name? The file will be saved in the same location each day.


#2

Hi @TomG,

Assign a variable the current date: DateTime.Now.ToString(“dd-MM-yyyy”) - or any format you’d prefer.
Then pass it to the Workbook path adding “.xls”

Here you have an example
excel.xaml (8.9 KB)


#3

@ovi is straight forward if you know the file name except the date part.

something like this should work

strArray = Directory.GetFiles(“c:\temp”,Now.ToString(“MMddyy-*.xlsx”))

Read Range strArray(0)

Or

Only Todays Files

strEnum = Directory.GetFiles(“c:\temp”,Now.ToString(“MMddyy-*.xlsx”)).Where(Function(x) new FileInfo(x).CreationTime.Date = DateTime.Today.Date)

Read Range strEnum(0)

Or

if you are sure about file

strFile = Directory.GetFiles(“c:\temp”,Now.ToString(“MMddyy-*.xlsx”)).Where(Function(x) new FileInfo(x).CreationTime.Date = DateTime.Today.Date).First

Read Range strFile