For Each row running non stop

I have a flowchart with csv and for each row running continuously. The csv has only

2 rows of data it should stop after 2 runs. How can i achieve it ?

Check the row count of docinformation2 … ? Seems empty records are getting looped from csv file

The csv doc has only two rows. Is there anything else which i missed ? Can we set the run count in some fields ?

If your csv files had records earlier and you deleted it by selecting the cells, this issue occurs.
To confirm this, Create a new sheet and copy only the first two rows that you want to loop to the new sheet. Delete the old sheet and rename the new sheet to required sheet name.

Now try executing the BOT.

1 Like

@Aaditya, Use Write Line Activity with value dtVariable.Rows.Count.ToString, to confirm row count before For Each Row Activity.


1 Like

@Bhavik_Solanki Should i add this in flowchart before for each row ?

@Madhavi I tried, it didnt work.

Is its possible to share the csv file?

@Madhavi i am unable to attach the csv file. Its not supported

Zip it and send

New Compressed (zipped) (387 Bytes)

@Aaditya, let me rephrase. Add Write Line Activity between Read Range Activity and For Each Row Activity with value “docinformation2.Rows.Count.ToString”. I assume docinformation2 DataTable variable is used to populate information from Read Range Activity.

simple workaround

Use if condition in For each

Condition Not row(0).ToString.Equals("")

which checks the first column values of a row. If it is null Put a break and loop out


I have tried with the File,you have provided and it is working fine :slight_smile:
Can you check the workflow which is attached along with this ?

If you are facing , the issue could be that there is a data in some other row.
You can doCtrl+down in the csv file and check. (13.6 KB)

It is looping back to first row instead of 3rd empty row