web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to break "Apply to each" action

(0) ShareShare
ReportReport
Posted on by 284

Hi,

I have a "Apply to each" action to read each row in the excel. Sometime the row is empty so when such row is detect I wish to break this loop. Is there a way to do it?

I have the same question (0)
  • Mira Ghaly Profile Picture
    11,409 Moderator on at
    Re: How to break "Apply to each" action

    Hi @sbgoh ,

     

    Add a Condition Expression at the beginning of the Apply_to_each loop to check if the row is empty.

     

    If this post helps you with your problem, please mark your as Accepted solution.

    If you like my response, please give it a Thumbs Up.

    MG (Naturally Curious)

     

  • Verified answer
    v-litu-msft Profile Picture
    on at
    Re: How to break "Apply to each" action

    Hi @sbgoh,

     

    @Mira_Ghaly is correct, before going to Apply to each, you could create a condition action to determine the number of rows.

    Add one point, how to get the length of rows, you could use length() function to get it, its return is a number:

    Annotation 2020-08-10 134920.jpg

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • sbgoh Profile Picture
    284 on at
    Re: How to break "Apply to each" action

    Hi

    I set about 100 rows in the excel and format as Table. But sometime the user will only upload less than 100 rows so I don't want the system to continue looping 100 times.

  • v-litu-msft Profile Picture
    on at
    Re: How to break "Apply to each" action

    Hi @sbgoh,

     

    You could use List rows present in a table action + Filter array action to filter out these empty rows, then use Apply to each action to loop them.

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 535 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 348 Moderator

#3
developerAJ Profile Picture

developerAJ 262

Last 30 days Overall leaderboard