Excel saves automatically

Hello everyone,

I am currently working on a robot that goes through a database et writes cell in another excel files.
The excel file saves everytime I write one cell so it takes a long time …
Is there a way to save only at the end to improve the performance ?

Best regards,
Thomas

Hi @lemoinethomas,

  1. You can build a data table, you can use Build Data Table activity.
  2. You can keep adding your rows in between your process by using Add Data Row Activity.
  3. At the end you can directly write that temporary/newly created data table (which you filled during your process) using Write Range Activity. This activity accepts a data table to write into the excel file.
  4. Hence instead of writing each time you can write the data once to excel file.

Hope this logic will work in your case, if i have understood your problem.
Give a try.
Regards,
Jiban

1 Like

Thank you very much for your answer. It could work and seems to be the best practice but I need to write in specific cells of an already existing excel file …

By the way it doesn’t seem to work if the excel file is not opened.
I get this error right away : Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

It doesn’t happen when the file is opened on my desktop

Hey @lemoin

  1. If you want to write to specific cells then we have to choose the particular Cell, so we have to use the write cell activity. You have to compromise then with the performance.
  2. If you slightly modify your logic, then you can use SQL Query also to retrieve and to update data in Excel sheet. First check if this SQL Query method will meet your requirements.
  3. Make sure that you have closed your excel file (used in code) if you are dealing with excel activity. If you don’t close it, then the Robo will face a deadlock condition and throw exception that the file is being used by another application/process.
  4. Check your excel template if they have some formatting to that particular cell. Check The Parameter what You are Passing. Example: u may Be Passing String which has value for integer

Note: If you can share some detailed information/workflow then it will help us to understand in depth.

Regards,
Jiban

Thank you for your answer, I will have to compromise with perfomance :wink:

My main problem is this error : Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) when the destination file is not opened.

UiPathForum.xaml (61.2 KB)

Please find attached my workflow, JDD is the source file (csv) and Matrice is the destination file.

Best regards,

How do I add data row from a scrapped data?

What is the scrapped data? Is it a string value or a data table?

It’s a data table. We can’t add data table into data row right? If that is the case, how should i go with it?

If it is a data table, first use a for each row activity and fetch all the required fields from that data table and store them in different variables.
In Add Data Row activity: Pass one data Array in the form of Ex: {variable1,variable2}
Note: Before you add the data using add data row activity, make sure that you have a empty data table and
the number of values you are going to add = the number of columns you have in the empty data table.

Perfect, I’ll try to work on it from here. Thanks mate.

Can someone PLEASE,PLEASE tell me how to do something similar in UI PATH STUDIO X?
I have studio X and I cannot allow my variables to be stored one at a time in a cell in excel, but I am also unable to grab them all as a table, so I fetch them one at a time, but I want them to be written ALL AT ONCE to excel so excel only SAVES ONCE at the end of the automation.

Do I need to push all the variables im storing in memory into a list and then write that list into an excel file at the end?

How do I accomplish this?

Uncheck the save property on the excel scope. Do all your operations then save at the very end

THANKS. So I will get text and store it in memory first using a browser application
then i can reference all those variables I grabbed off the webpage and store them all at once in excel
it wont save after each write cell, will it? just one save after all the write cells are done?
OH I SEE, THE SAVE EXCIL FILE activity

heres hoping this is all in studio x, it should be.

thank you very much

1 Like