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

Notifications

Announcements

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
    12,966 Super User 2025 Season 2 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
    410 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
    12,966 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

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

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard