HOW to Create excel file at run time/DYNAMICALLy

Hi all,

Can anyone please help me with , HOW TO create excel file from Uipath, every time I run the code it should add todays date to the excel file.

example:
abc_5/4/2019.xlsx

Can you please help me.

1 Like

Provide the path with the new excel name in the excel application scope as time.now.tostring, it will automatically create the one

Hi @Seem

You can check the create new file option in properties of excel application scope to create a new file every time the bot runs. check the below screen shot.

and in the filename you can append the date to file name like “abc_”+now.tostring+“.xlsx”

@Seem,

Use Create File activity to create file and pass below:

Name: “Excel-”+Now.ToString(“dd_MM_yyyy”)+“.xlsx”

Path: folder path

@lakshman
I was able to create but I got an error:

Excel cannot open the file - 'Excel-05_04_2019.xlsx .boz the file format or file extension is not suppored"
:frowning:

Just check flag “createNewFile” within Excel application scope activity.

@sandipauti

I have no used excel application scope activity.

I have used the Create File

@Seem Is it possible to attach your xaml file.

@Seem - attach your .xml file for reference.

Ok @sandipauti,
@indra

@Seem Check attached file is working

excel dyanmic.xaml (16.0 KB)

@Seem - You can just make path more unique by adding ““Excel”+”-“+Now.ToString(“dd_MM_yyyy_h_s”)+”.xlsx"" hours and second parameters. That will every time create new file as per the timestamp string.

@Seem

Use Excel Application Scope activity and check createNewFile in property. And pass Workbook path as: “Folderpath\Excel-”+Now.ToString(“dd_MM_yyyy”)+“.xlsx”

Let me know if you face any problem.

@indra

I got the same error

@Seem You can prefer excel application scope know instead of create file activity is there is any specific reason behind that you are not using excel application scope?

@lakshman

I added excel application. checked the create new file.

Its not working

Can an one help me immediately Please

@Seem Check this CreateExcelWithTodaysDate.zip (15.7 KB)

1 Like

@Seem - is there is any error you getting while execution of process? if there is any kindly attache else you have to make more dynamic path by adding hours and second in path string

1 Like

@Seem,

Here path\Excel- is wrong.

It should be like this: path+“Excel-”+Now.ToString(“dd_MM_yyyy”)+“.xlsx”

Eg. Where path = “C:\Users\lakshman\Documents\”