How to add DATETIME Feature into excel sheet file name

Main.xaml (7.6 KB)
project.json (1.4 KB)

Hi Guys,

I had been trying to write datetime.now feature into my filename.

I had attached what I have done till now. I did just try random wild guess of

“Filename”+datetime.now.tostring+".xlsx"

Trust me this never works even I tried this thing also

path.GetFullPath(“D:\uipath”.ToString)

path.Combine(folderpath.ToString,“Test”+system.DateTime.Now.ToString(“dd:MMM:hh:mm:ss”)+".xlsx")

The above has also an error it says ) that closed bracket expected.

Please help TIA

Regards
Rahul

You cannot use “:” in the file name…

image

I simply changed your code as shown below…and it worked…

image

1 Like

Hi @Rahul_Singh_Kamboj ,

As mentioned by @prasath17 , you cannot use colon in file path

Try this
path.Combine(folderpath.ToString,“Test”+system.DateTime.Now.ToString(ddMMM_hhmmss”)+".xlsx")

Instead of colon you can also use underscore.

1 Like

This works but I have been assigned to make a file name as this

Pull out the only data from Sheet1 which is available in sheet2, and save it in New excel named as "Filtered_Data_dd:MMM_hh:mm:ss.xlsx

Sorry, I didn’t get you…

Thanks, everyone the best way to do it is

"FileName"+System.DateTime.Now.ToString(“dd.MMM_hh.mm.ss”)+".xlsx"

forget path combine or anything just by taking care of the .(dot) and without using colon this can work.

“Filtered_Data_dd:MMM_hh:mm:ss.xlsx”

the file name cant come as shown above right ?

Yes, I have already shared you a screenshot on why you can’t use : …

it would be great, if you make pertinent post as solution so that users will be benefited.

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