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 / Using workbook.refresh...
Power Automate
Unanswered

Using workbook.refreshAllDataConnections() to refresh connection doesn't work in Power Automate

(0) ShareShare
ReportReport
Posted on by 16

I'm using a script to refresh the connection to an Excel file. This to ensure that the latest edit of the file is included when the Excel content is retrieved. I tested the file multiple times. In some instances I got the right content with the updated tables. However, for some instances I did not get the updated tables. It seems that workbook.refreshAllDataConnections() is unreliable. I can't find any cause to the inconsistencies. 

First I used a 2 minute delay timer, which is slow and unreliable. Then I found this script on this forum.

The script:

function main(workbook: ExcelScript.Workbook) {
    // Refresh all data connections
    workbook.refreshAllDataConnections()
    ;
}
 

My flow first gets input from a sharepoint list and then

(1) adds the content by editing a row of a table in an excel file.

(2) Edits a row in another table .

(3) Runs script that should refresh the connection to the Excel file.

(4) Gets latest Excel file content via a new connection.

(5) Adds content as attachment to email and saves an Excel file in sharepoint.

 

 

Piter170_1-1710241147951.png

 

 

Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @Piter170 ,

     

    Unfortunately, the workbook.refreshAllDataConnection cannot run when you call the script from Power Automate. This is the information from Microsoft official docs:

    rzaneti_0-1710281696600.png

     

    Source: https://learn.microsoft.com/en-us/office/dev/scripts/testing/power-automate-troubleshooting#refresh-not-fully-supported-in-power-automate 

     

    Let me know if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

    http://digitalmill.net/ 
    https://www.linkedin.com/in/raphael-haus-zaneti/ 

     

  • Piter170 Profile Picture
    16 on at

    Hi @rzaneti ,

     

    Thanks for your reply. So workbook.refreshAllDataConnections() is not an option. 

     

    The only alternative I can think of for my use case is a delay timer as a buffer to make sure the connection is refreshed and the flow retrieves the latest data. This is a feasible option for me. However, it's an ugly solution. How long should I delay? Do you have any ideas on alternatives?

     

    1. edit an excel file

    2. Delay by 2(?) minutes

    3. Get updated Excel file content

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard