For Each Row x25


I am using a program that only allows 25 queries at a time. I have an excel file that it will pull the data from copy and paste it into the search run a process and then update the excel file to say the queries have been run.

So my problem is, I want to run a ForEachRow activity for 25 lines of data, run the process, take the results and paste in excel file, then run the next 25 lines where it left off.

Any help is much appreciated,

Hi @heblightning

Welcome back to the community after a long 4 months.
Wish you a very happy new year!!

So for your scenario, we have to use multiple set of loops to handle it.

First use a while loop with the condition set to true. This loop will run until we break it. Why we need this loop is we have to continuously run it for each rows/25 number until a rows are processed

Now within this loop have a read range to read the data in the excel.i suggest you to have a status column in the excel so that bot can update the status of all processed data each time it execute a record. Once the data is read onto a datatable, use a filter datatable and filter out the processed records so you will have only the records to be processed.

Now use another for each row activity inside the loop to navigate through the records.
Here we have to use a counter variable keep track of the number of records processed. When for each row activity.loops for 25 times, we have to break it and get back to the outer loop and start the next iteration.

Inside the for each row loop, once the record is processed update the excel row with the status complete and the break and move to outer loop for next iteration

Hope this helps

1 Like

Ty! @Lahiru.Fernando

I’m still very new to coding and using UiPath so I have a few more questions if you don’t mind.

As of now I have a While loop and inside that a sequence where I have an excel scope, a read range and then a filter table. I know I’m missing something else to actually get it to sort.

Outside the excel scope but still in the while loop I have a ForEachRow activity. What do I need to do for it to only process/loop 25 at a time?