Extract data from a Datatable and creating always a new excel file

Hi,

I have an issue with exporting data table to excel. It works fine for me, but the problem is how to make it that it creates always a “new” excel file - not to overwrite the existing (for example: today it creates three or four excel files, or with any other attempt when robot read by data scraping function one table it creates always a new excel file). I hope I was clear enough.

I would appreciate a hint or help,

Thans in advance

1 Like

As per understanding you want to create new excel every time:
If it is ryt then Whenever u write the datatable in excel then u can set Name of excel dynamic

For ex for daily basis:
"NewExcel_"+Date.Now.tostring(“dd_MM_yyyy”)+".xlsx"

Fine
While mentioning th excel file path mention it with a time stamp
Like this in excel application scope
“Yourfolderpath”+yourexcelfilenamewithoutextension_+Now.ToString(“hh_mm_ss”)+”.xlsx”

We can’t keep date here because you say four files are getting created daily so keeping the date will result the same

Cheers @zlatko_gradascevic

Thanks to both of you guys, but it still does not correspond to the what I need.

When I have applied first solution:

Path: C:\NewExcel_"+Date.Now.tostring(“dd_MM_yyyy”)+".xlsx"

it created file named: NewExcel_16_08_2019 (it is ok)

when i started Robot again it just creates the file with the same name but in description is no longer 14:22 but 14:25 (so it works on a daily basis as You said and overwrites the existing file).

When I applied second solution @Palaniyappan :

“Yourfolderpath”+yourexcelfilenamewithoutextension_+Now.ToString(“hh_mm_ss”)+”.xlsx” did pretty similar scenario.

Maybe I was not clear enough and I will try to clarify:
With data scraping I read one data table and output is ExtractDataTable.
Then I open Excel application scope and define a path: C:\Probe.xlsx, then in Do sequence under Excel app scope I defined “Sheet1” Cell “A1” and in datatable field ExtractDataTable

It will create of course an excel file. When again I start the robot I want him to create a new excel file and again and again… so many time as I start Robot.

Maybe I did not correctly wrote above mentioned codes:-)

Thanks,

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