Renaming a Excel File in UiPath

Hi All
I have an Excel file which I want to rename to current date.
I am trying move, copy, invoke code, but it says “File format not supported”.
Can you please help in this regard what way the file name should be written in order to have it renamed.

I am using Move File Activity and in Destination I am giving as:

“C:\Users\Project Name\StatusReport\FileName”+Now().ToString(“dd-MM-yyyy hh:mm:ss”)+“.xlsx”
but still it gives “The given path’s format is not supported”

Please help.

Thanks

Hi @Heena_Saini
hopefully this helps you:
I assume that you are missing “system.datetime” before .now

cheers
Timo

I tried using System.DateTime, but still same error.
Getting same error "“The given path’s format is not supported”

Hi.

A filename can’t have certain characters. I recommend for dates, only use ‘.’ or ‘-’
Now.ToString("yyyyMMdd.HHmmss")

EDIT: also, reason I used that format is so you can sort the files by the date. If you use MMddyyyy, then all the months from 2019 and 2020 will be sorted together rather than in order.

Regards.

2 Likes

the ":" character in your filename might be invalid. Please replace it by another character, like a "-"

1 Like

hi @Heena_Saini ,
Now().ToString(“dd-MM-yyyy hh:mm:ss”) return you 30-04-2020 07:51:23

So , we cannot have : colon in the FileName.

Please take a variable , Replace Colon with Underscore as shown below and then use it in the FileName



Mukesh

1 Like

Thank you all.
Yes, the semicolon “:” was not correct to use in filename.
Thank you very much.

Happy Learning. :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.