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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to make my flow wa...
Power Automate
Unanswered

How to make my flow wait the end of the foreach

(0) ShareShare
ReportReport
Posted on by 33

Hi folks!
I have flow to export data to a excel file, it receives a json as parameter from the powerapps and return the file path.  in the middle of it, it's had a "apply to each" to add the json objects into the rows of an excel file. but when it returns the file path to download the for each it's not done yet and the powerapps download a file with only two or 3 lines of data. So, to get the complete file I have to wait some time and then go directly to path and download.

 

RaphaelMelo_0-1710181744487.png

 

Categories:
I have the same question (0)
  • Andrew_J Profile Picture
    1,962 Moderator on at

    @RaphaelMelo 

     

    Add a delay step in the flow and set this for five minutes.

     

    Regards,

     

    Andrew

     

     

  • RaphaelMelo Profile Picture
    33 on at

    The delay doesn't solve the problem, cause if the "apply to each" runs longer than it the problem will continue.

  • David_MA Profile Picture
    14,918 Super User 2026 Season 1 on at

    I don't know that this will solve the issue, but I would create an int variable and populate it with the value of a length expression to tell the flow how many rows of data you have in your JSON data (maybe name it total rows). Then create another integer variable and set the default value to 0 (zero) (maybe named processed). Then in the apply to each, increment "processed" by 1 after each item is completed. Put the whole Apply to each within a Do until and set the logic to be where rows equals processed.

     

    This isn't something I have tried before because I don't understand how your flow moves on to the next action before the apply to each is completed. It will be interesting to see if this solves the issue in case I encounter this.

  • wyattdave Profile Picture
    493 Moderator on at

    It looks like the issue is the Power App is timing out the flow. The App will only wait upto 2 minutes (I think). You need to do a polling flow, I wrote a guide here.

     

    https://dev.to/wyattdave/how-to-power-apps-getting-polling-update-from-file-upload-547g

  • David_MA Profile Picture
    14,918 Super User 2026 Season 1 on at

    Looks like I was at least on the right track with the do until. 🙂

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 484

#2
11manish Profile Picture

11manish 282

#3
David_MA Profile Picture

David_MA 280 Super User 2026 Season 1

Last 30 days Overall leaderboard