Exit Loop for Each Excel Sheet

Hi All.
Please help, I need to exit loop when condition is met on specific sheet. So I use “for each excel sheet” activity. I would expect that “Exit Loop” should work, but it generates an error: Only activities which have been requested to cancel can call MarkCancelled.

I also tried with “For each row”, it works. Only with each excel sheet I get an error. Is there any other way to exit loop? As I don’t want bot checks every other w/s, when it met condition already.

My simple example:

Error message:

Thank you.


In my environment, I can reproduce this error with Excel.Activities package v2.11.4. However, in v2.12.0-preview, it works.
So if you can use preview version package, can you try to upgrade to v2.12.0-preview? (It might be needed to modify filter settings in Manage Packages)


Hi @Volodymyr_Myshko ,

As per the documentation from UiPath. Exit loop activity can only use with one of the following activities Excel For Each Row , For Each Mail Message , or For Each File In Folder .
The For each excel sheet is not listed under these activities. Could you refer the below documentation. May be @yoichi suggested we have to go for latest preview packages. thanks.

Thank you very much. It works now.

1 Like

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