Exit for each row

I have created a “for each row activity” . It will take the values from the excel columns and will post in the respective fields in web browser. The loop is taking one by one perfectly. But once i got the empty row its not breaking the loop. Which i dont know how to do it. Please heforeach.xaml (34.5 KB)

1 Like

@KavithaManivel You can use break activity to come out of the loop. Put this break activity under condition like if(row.IsNull) then break.

1 Like

Hi Singhonkar,

The mentioned code i can use directly if(row.IsNull) because iam getting
“overload resolution is failed because no accessible”


Use this in an if condition, string.isnullorempty(row(0).tostring)

So the above condition checks whether data at a particular row and column 0 is Null or empty.


Once you get the empty row what its saying?
Suppose you get and error you can surround the dor each loop body insode try-catch and inside catch you can put a break statement.
Because sometimes even the special charecters wont be isplayed we may think it as space or empty string but it wont get matched.


1 Like

Iam not getting an error the bot is continuing

See basically iam getting the data from the excel sheet. Its iterating properly within the sheet. But moment its found the empty row the bot is not stopping the loop.

Can you quick check the ttal rows in excel are same as in the read range datatable?



Can you debug the workflow and check first the condition is getting satisfied or not when the row is empty.

If the condition is satisfied , use break activity

You can ignore the empty rows using if statement with condition as
row.ItemArray.All(function(x) String.IsNullOrEmpty(x.ToString))

Its working fine. I made a mistake in my flow. Thanks for your support.

1 Like

U can use Break