Stop read ranger to datatable when there is no more data

I am creating a robot, to read excel, my problem is that if I put read the range, it captures me to infinity and I need it to stop the activity when an empty line is found. thanks

Hi @Kuro

Use If condition

Pass the value String.IsNullOrEmpty(Currentrow(“YourColumnname”).tostring)

Then → Use Break activity in it
Else → You can continue the process


Check out the image @Kuro



In the event that I had to base the if on 2 columns, how would it be?

Hello @Kuro

I hope you are using the datatable in a loop. If that is the case it will stop at the last row.
You can use Filter datatable activity and add the condition on the column to remove the zero valued columns.

Can you please share a sample excel for more clarification?


Hi @Kuro

In If Condition Just use below Expression

String.IsNullOrEmpty(Currentrow(“YourColumnName1”).toString) AND String.IsNullOrEmpty(Currentrow(“YourColumnName2”).toString)

Loveleet Saini

You can use like this

String.IsNullOrEmpty(Currentrow(“YourColumnname 1”).tostring) And String.IsNullOrEmpty(Currentrow(“YourColumnname 2”).tostring)

Hi @Kuro please try this linq query
dt.AsEnumerable.TakeWhile(function(row) not string.IsNullOrEmpty(row(column index or name).ToString)).CopyToDataTable
This will help you achieve what you need


Sreejith S S

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