How to iterate a file without going back from the top row


I would like to know how to iterate a file in excel without going back from the top row instead robot will look for the next appropriate row to process. Thank you

1 Like


Sorry I did not get you. Could you please tell more details about the issue.

@julius.mapili r u saying that while iterating your excel it should not start with first row am I correct. In read range specify the range from where it has to start.

If you have an excel with 10 rows, you want to start at row 1 and go to row 2 etc…

You can read the excel into a datatable then use a For Each Row to access each line.

Kindly elaborate your scenario buddy that could help us to go in a right direction
Cheers @julius.mapili

Sorry for the vague description. Lets say i have an excel file that consist of 100 lines. The robot will process the 1st line and so on. Now when the bot need to reject a certain lines lets say line 10, what i did was instead of going to line 11, it will go back to line 1 and start all over again.

1 Like

so you want to reject a line go to next line rather staring from the beginning
am i right buddy
Cheers @julius.mapili

Thats right.

1 Like

–so use a excel application scope and pass the file path of excel
–use read range activity and get the output with a variable of type datatable named outdt
–use a for each row loop and pass the above variable as input
–inside the loop use a if condition like this
(this is just an assumption, put your own condition based on your scenario buddy)
say if you want to reject a row if a column A has any value like “ABC”
then use a conditon like this
if the condition passes it will go to THEN part where we can leave it empty which resembles that we neglect that row
and if the above condition fails it will go to ELSE part where we can include all the activities we want to perform

Kindly correct me if i m wrong
Hope this would help you
Cheers @julius.mapili

1 Like


If possible you can add an extra column in your excel to get the status of the transaction.
When you reach the end of the process, or an exception, you add on this new column the status of the transaction like “OK”, “Failed - Data missing” or things like this.

yourColumn1 | yourColumn2 | yourColumn3 | newColumnForStatus

In the beginning of your For Each, you can create a decision/if to check the valor of this new column.
If the new column = “OK”, the robot just goes through this and check the next line until reach on a status <> “OK”.

With this solution your robot will always back to the first row, but will only handle cases where the status is <> “OK”. You can put some rules on it.

Hope i can have helped you :slight_smile:

It depends on how you have built you automation.

If you are rejecting within the same component then you can do as @Palaniyappan has suggested and update accordingly.

If you have split Exception handling in another workfow etc, it might be better to navigate your datatable using a flowchart and indicate an increment counter for row index (this can be passed between workflows / states as an argument)

You would then assign the current datarow as Datatable.Rows(IntCounter)
After completing that row you would increment IntCounter =+ 1

1 Like