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 / Inconsistent Results W...
Power Automate
Unanswered

Inconsistent Results When Using "Update a Row" Followed by "Run Script" in Apply to Each Loop

(1) ShareShare
ReportReport
Posted on by 5

Hello everyone,

I'm encountering an issue with a Power Automate flow involving Excel Online. Inside an "Apply to each" loop, I initially used the "Update a row" action to modify a row in an Excel table, followed by a "Run script" action that executes an Office Script on the same file.

The script is straightforward—it generates a scatter plot based on the updated row values. However, the results have been inconsistent:

  • Sometimes, the flow runs perfectly and all rows are processed with the correct values.
  • Other times, the flow still completes successfully, but the first row processed ends up with incorrect values in the chart generated by the script.

I verified that the values passed to the "Update a row" action were correct at every step. I tried several workarounds, including:

  • Adding delays and "Delay until" actions
  • Using conditions to control execution timing
  • Replacing "Update a row" with "Add a row"
  • Adjusting the concurrency settings of the loop

Despite these efforts, the issue persisted. It seems like there might be a timing or caching issue between the "Update a row" and "Run script" actions—especially since the problem consistently affects the first iteration.

Temporary Workaround

For now, I’ve resolved the issue by removing the "Update a row" action entirely and instead passing the necessary parameters directly to the Office Script with the Run Script action. I modified the script to accept these inputs and generate the chart accordingly.

While this workaround appears to work, I’m concerned about scalability—I need to test this flow with over 600 rows, and if Excel Online has a caching or synchronization issue, even this approach might eventually produce inconsistent results.

I believe this is worth discussing further to identify more robust solutions or best practices. Has anyone else experienced similar behavior or found a more reliable workaround?

Thanks in advance for your insights!

Best regards,

RC

Categories:
I have the same question (0)
  • David_MA Profile Picture
    12,982 Super User 2025 Season 2 on at
    Since this post has been up for a while without a response, I’ll share my feedback, with the caveat that I don’t work extensively with Excel actions.

    That said, in my experience with large spreadsheets and many rows, workflows can sometimes run faster than the data is actually written to the spreadsheet. This can lead to issues, especially when multiple updates or row additions are involved. Also, a single Excel action can occasionally lock the file, requiring a wait for the lock to be released before the next action can proceed.

    In situations like this, I’ve found that adding a delay before the next action can help. It gives Excel enough time to finish writing the data and release any locks, which can make the workflow more reliable.
     
    Here is an example of my use of delays in one solution to resolve what seems like a similar issue you are experiencing:
     
    In the above, I generate the spreadsheet from scratch, without the delay, creating the table in the spreadsheet sometimes caused errors because the create table action ran before the file was finished being created. Here I have a one-minute delay, which has worked sufficiently since I implemented it.
     
    In the condition, it is adding the rows to the table based on some logic. Further steps down send the Excel spreadsheet generated as an attachment. This is why there is another delay after the condition. Again, the next action started before all of the rows had been added to the table, so the Excel file that was sent did not contain all of the data. For adding the rows, which for this process would be a max of 50 rows, I have a three-minute delay. This would need to vary depending on the expected number of rows you are dealing with.
     
    Hopefully someone will see this and can offer better advice. If you resolved the issues since you posted this, please share how you fixed the issue and mark it as the answer.

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

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard