Read Range : illegal character in path

Hello
I want to read range from excel file that has today date and downloaded time.
Like 전자납부_202111300355.xlsx

To read range, I used it.
image

and StrExcel (string) is “전자납부_” + now.Tostring(“yyyyMM.dd”) + “*.xlsx”

How can I solve this problem…?

Hi @111153
Could you please mention the excel file name ?
Thanks,

Excel name changed depends on downloaded date…

전자납부_202111301535.xlsx → 2021.Nov.30th. 15:35
but I don’t need time, so I tried to use now.tostring(“yyyyMMdd”)
Do you understand??

First, rename your excel file as your format and then use that in read range

If you have not renamed, Uipath will not be able to find the excel file

Regards
Sudharsan

i saw your excel file it contains date with time , but it is not reflected in the string as you defined

I think Excel name doesn’t have problem.
If I don’t use StrExcel, it works well.
I think “전자납부_” + now.Tostring(“yyyyMM.dd”) + “.xlsx”
it has some problem…

Is it impossible to use argument on Read Range location???

Ahh I deleted dot on yyyyMM.dd, but it makes same error.

Is that impossible to use argument on read range location?

Hi @111153

Use the format as mentioned in File name

Check with the Path exists activity and select type as file!

"YourFilename"+Now.toString(“yyyyMMddHHmm”)+".xlsx"

Regards

1 Like

Of course it has problem

Your file name is 전자납부_202111301535.xlsx

You are giving the filename as 전자납부_20211130.xlsx
I think this is the problem

Regards
Sudharsan

Hi,

I think we cannot directly use a file name which contains time stamp in it.

Create assign activity →

FilePath = “전자납부_” + now.Tostring(“yyyyMMdd”)

Create a string array like below

Use For each loop to get the exact file path contains timestamp in it.

Pass this correct file path to you read range to get the data into data table. thanks.

IS * means that unknowned letters?

LIke If I searched words using AP*, it will find all words it contains AP?

Hi @111153

if you want to read recently downloaded excel file
Kindly refer my xaml file & Try out this

Thanks,
TodaysNewestFileIinDirectory.xaml (9.9 KB)

But downloaded time, and read range time could be changed…
SO I used * after date.
As I know, * means unknown letters. Am I wrong?

I made assign like this
image

but I don’t understand… where to use arr_files
fill the workbook path blank of read range by arr_files?

Hi,

Please refer the sample work flow. i hope it would help your automation. thanks.

FilePathDemo.zip (2.6 KB)

isn’t * means unknown letters?
If I searched words using AP *, it will find all words it contains AP?
apple
appearance
approach etc…

yeah you are correct. in our case time stamp will change dynamically so we cannot get by using functions it will not provide the desired file path. we have to use the directory class and use some filters by using Asterisk(*) symbol to find out the values.

For using filter we have to give the most constant pattern.

@111153

If you want only the latest downloaded file then

Directory.GetFiles(path).[Select](Function(x) New FileInfo(x)).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()

This will always output the latest file

Hope this may help you

Thanks

Please use “Get workbook sheet” activity and use the index of the sheet to reference it to a variable which you can use to fill this parameter on the Read Range activity.