I need to do a data entry from an Excel to a website which works perfectly fine.
So I uploaded my excel and stored in a datatable.
I used a For Each row of my datatable and have a Body with all my Type Into activities.
I want to write “Success” in a column after each full entry it has done - I suppose at the bottom in my For Each Loop.
I only want “Success” as the robot will stop if any error.
My Excel is as this:
I expect it to be like this when doing the entries:
Can someone help please?
UIPath_Excel_Scratch (6).xlsx (25.2 KB)
In assign activity left side give row(“Status”) and in right side give “success” it will automatically update value in specific row.
I don’t have the column “Status” yet. I would want the bot to create that column for me. How do I do that please?
Use add data column activity in property you can give the column name, column type, default value etc…
Okay thanks. I have one more question. Suppose I have 100 entries and I STOPPED the robot at 50. The “Success” will not be written in the Excel as the Write Range is outside the For Loop.
So I should have a write range in the For loop itself?
please use for loop inside try catch , so if you have no error after for loop in try the data table will be write to excel, or if you have any error in catch you also have to write the data table in excel. based on this logic even when error occurs the current updated data table will be written in the excel.
Wait, I use For loop inside Try Catch or use Try Catch inside For loop?
But if I manually stop the robot, it will not write the excel though, right?
For loop inside try catch , may be after every loop you can use write range so that we can avoid data loss, even if you stop the bot or error comes (because we use write range inside catch also) it will update the latest data in excel.
I am adding the Column and it run well the first time but when I run it the second time I get this:
Add Data Column: A column named ‘Status’ already belongs to this DataTable.
How do I have like an If statement which says if column does not exist then Add else continue?
Use add data column activity before for each row activity so that it will be executed only one time.
hi, Dear, my excel file has a column called “Status”,but I tried you method below,
[In assign activity left side give row(“Status”) and in right side give “success” it will automatically update value in specific row.]
it is not writing to my file. The column “Status” is empty, would you please help?
Thanks in advance.
At the end of the process did you use write range activity because we updated the value in datatable only ,and if we want to update in excel we have to use write range activity (pass the excel file path and datatable)
if I use write cell there is another question, the cell need to be dynamic, for example, the Status is dynamic, and write from B2 to B30
But the cell here writes B2.
use write range activity instead of write cell activity and pass the datatable
It should be A1 as it starts write from there
wow it works! Thank you so much: )
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.