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 / Do Until loop & List R...
Power Automate
Suggested Answer

Do Until loop & List Rows in Excel issue - When is list rows evaluated and can you force this?

(0) ShareShare
ReportReport
Posted on by
Hi,
 
I have a flow which is trying to pull hierarchical data into an excel file via a loop but part of it isn't working.
 
The basic structure is:
  1. Take the top tree item and output this into an excel table with a column called 'Processed' set to 0
  2. Initialize a variable called Parent and set the value of Parent to be the id for the top tree item
  3. Start a Do Until loop
    1. Get all direct child elements from the Parent and output them into the excel table with the 'Processed' column set to 0
    2. Set the 'Processed' column for the top tree item as 1
    3. List rows present in a table with a filter for 'Processed eq 0' and 'Top Count of 1'
    4. Set the Parent variable to be the id from the List rows action above so that the loop continues with the next unprocessed record
    5. Loop until there are no 'Processed' columns set to 0
No matter what I seem to do, the List rows action in step 3.3 always returns the top tree item ignoring the update from step 3.2
 
I have tried doing this all in one flow, I have added loops to check until the 'Processed' column has definitely been updated (using the excel a Get a Row action), I have set this up as a solution with the List Rows in a child flow. If I cancel the flow and then re-run it, it will move onto the next record but then get stuck on that one so I know the filter etc. is all correct. And if I open the excel file I can see the record does update when expected but the List rows action is completely ignoring this.
 
It feels like the Do Until runs the excel list rows action once at creation and then never re-evaluates it but I can't find anything documenting this. Any ideas how I can fix / work around this?
Categories:
I have the same question (0)
  • Suggested answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
     
    A possible cause for this issue is a file lock due to the update in the 3.2 step. As you can see from the docs, this is a limitation from Excel connection (an update/delete operation can lock the file up to 6 minutes):
     
     
    As a solution, you can try to include a delay of a few minutes to avoid the lock: from my personal experience, it usually takes no longer than 1 or 2 minutes to release the file. 
     
    Another possibility (complex, but much more efficient) would be to work with the Excel Graph API or with an Office Script. I'm more familiar with the Office Scripts approach, and sharing a few content that I created about this topic:
    - Video: Writing data into Excel ranges (outside of tables) with Power Automate and Office Scripts - https://youtu.be/-OGYQEQSP-0
    - Blog: Sending values from Power Automate to Excel with Office Scripts - https://digitalmill.net/2024/01/17/sending-values-from-power-automate-to-excel-with-office-scripts/
    - Video: Add Thousands of Rows to Excel in Seconds with Power Automate + Office Scripts - https://youtu.be/Ay9XrawKqps
     
     
    The downside of the Office Scripts is that it requires some basic understanding of Typescript programming language and it's not a feature available in all organizations. 
     
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
     
    I just want to confirm if you had a chance to test the solution recommended in my previous message.

    If it works properly and answered your question, please mark it as Accepted Answer, so other users with the same issue can find it easily in the future :)
     

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard