Bot execute 2 times the last row in excel

In my process i am using EXCEL1 that the bot takes all the rows to execute
and after executing the row it write it on a excel 2, for that i am using for each row.
The problem is that execute 2 times the last row from the EXCEL 1 instead of 1


I am sorry I am not fully understand your issue. May be if you share sample work flow I will happy to troubleshoot your workflow.

Just thought from my side could you please verify in the read range activity add header checked or not. If you do not check add header it will consider header also one of the row and due to counter in the loop it can execute last row twice I am just guessing. Thanks.

1 Like

If you are trying to write the updated datatable from excel 1 to new excel 2 then we can try using write range activity after the for each row activity so that it will write the DATATABLE to the new excel file

Make sure add headers is enabled in write range activity

Cheers @Soudios

1 Like

Best approach to understand the issue is to debug

Have the datatable variable in the Watch section of debug panel and see where the last row is getting added in the datatable.

As suggested my Palaniyappam, you should use write range to write the datatable in a file. Any specific reason you using for each Loop to write?

Hope this helps!

1 Like

@Palaniyappan @rahulsharma

I added “add headers” but when i do that, the process end after few second.

I have a condition that : if it find “creation” on a column in excel 1 then the process will continue as below, it was working before adding “add header” but i had 2 times the same last row, and when i use add headers nothing happen

@rahulsharma i am using for each loop because i need to search the information on web for every rows

Maybe i need to delete the last row or duplicate row ?


  1. In that case before for each row activity use a assign activity like this

dt_temp = creation.Clone

  1. And use a clear DATATABLE activity where pass dt_temp as input

  2. Then use for each activity with input as Creation

  3. inside the loop use add data row activity instead of write range

5.Where in add datarow you can pass values of each column as a array like this in ArrayRow property
{“value1”, “value2”, “value3”,….,”valueN”}

  1. And in DATATABLE mention as dt_temp

  2. Or if you want to add the same data row from creation to new DATATABLE dt_temp then instead of passing value to ARRAYROW pass as row2 in DataRow property and DATATABLE as dt_temp

  3. This will add data once after you validate or get information from a browser

It’s like we are writing the output data in a DATATABLE first and then writing it to a excel after for each row loop using Write-range activity

Cheers @Soudios

1 Like

hi @Palaniyappan

Do you have a sample plz ?

Hmm I would be great if you can share the current workflow so that I can make the changes in it and forward you

1 Like

i found the solution i had for each row inside an other for each row that why i does’t work. i just removed the 2nd for each row and it worked

1 Like

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