Workbook.refreshAllDataConnections() is not supported in Power Automate.

MMPB 80 Reputation points
2023-04-20T06:58:58.2433333+00:00

Dear all, I have an excel sheet with an active connection which I am able to refresh to get the newest data.
Now I've got another PowerAutomate Flow which is working fine with a script inside this Sheet to send me via Teams numbers which I want to be notified about.   Unfortunately it only works if I am updating the workbook manually via Data-Refresh all, or if I am executing the script inside The workbook via automate this code line works:
"workbook.refreshAllDataConnections();"

It is now also possible to test the flow in Powerautomate and get all data (without the refresh code line).
With the refresh Code line I get this error message:

We were unable to run the script. Please try again.
Runtime error: Line 7: Workbook.refreshAllDataConnections() is not supported in Power Automate.
clientRequestId: 0b8eaf2a-1429-430a-8ae6-21fcf4330213

How can I refresh the workbook via Power Automate?

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,955 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,975 questions
{count} votes

13 answers

Sort by: Most helpful
  1. Alan Cussen 20 Reputation points
    2023-04-20T20:10:17.29+00:00

    I'm calling an Office Script from my flow. I got the same failure message this morning. I just dropped the "()" and my flow ran successfully again. <br> So change from this: workbook.refreshAllDataConnections()

    to this: workbook.refreshAllDataConnections

    2 people found this answer helpful.

  2. Yutao Huang - MSFT 701 Reputation points Microsoft Employee
    2023-04-24T16:00:52.3666667+00:00

    Apologize! This was indeed a regression on our side, and it should be fixed now. Please let us know if you are still having issues with refreshing Power BI data connections.   Thanks for your patience and support!

    2 people found this answer helpful.

  3. Shubhabrata Dey 10 Reputation points
    2023-07-19T12:30:28.37+00:00

    Hi All,

    I too had the same issue. Recently I have come across with the below link from Microsoft which says Power Automate will not support RefreshAll action. Refer the below link:

    https://video2.skills-academy.com/en-us/office/dev/scripts/testing/power-automate-troubleshooting

    I sincerely hoped such simple stuffs should have been covered by Microsoft ages ago.

    2 people found this answer helpful.
    0 comments No comments

  4. Travis Webb 5 Reputation points
    2023-09-27T14:17:54.1066667+00:00

    This is the main reason I used PA and this has been a trainwreck for me.

    1 person found this answer helpful.
    0 comments No comments

  5. Jaywant Ashok Thorat 0 Reputation points
    2023-04-20T08:14:13.9133333+00:00

    It seems like the issue you are facing is related to the limitations of using the refreshAllDataConnections() method in Power Automate. Since this method is not supported in Power Automate, you need to use a different approach to refresh the workbook data before running the Power Automate Flow. One possible workaround is to use the "Refresh Workbook" action in Power Automate before running your script to send notifications. Here's how you can do it:

    1. Open your Power Automate Flow and add the "Refresh Workbook" action from the Excel Online (Business) connector.
    2. In the "File URL" field, select the Excel file that you want to refresh.
    3. Click on "Save" to save the changes. Once you have added the "Refresh Workbook" action to your Flow, it should refresh the data in your Excel file before running the script to send notifications. Please note that this approach may take some time to refresh the data, depending on the size of your Excel file and the amount of data that needs to be refreshed. You can also add a delay action before running the script to allow time for the data to be refreshed.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.