How to exit exit a loop


#1

How do I exit a loop after my datasheet has been up dated on excel?


#2

Hi @kishanpatel728 !!

Maybe I don’t understand well the question but, it would be as easy as make a counter, when the counter exceeds a threshold, make it exit the loop.

Regards :mage:


#3

If you use the ForEach loop with name UiPath.Core, then you can use the Break activity to exit the loop early. Or just surround your sequence in the loop with an If condition so it exits when it hits the end of the loop.

If you are using a Do While (which I don’t recommend for Data spreadsheets), you can use a condition in the while part of the Do While which exits the loop (like if you use a counter for example). Alternatively, you can surround the Do While with a Try/Catch and use an If condition with a Throw inside to push out to the Catch part and exit the loop.

Regards.