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

MMPB 120 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?

Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows

12 answers

Sort by: Most helpful
  1. Jasper Z 0 Reputation points
    2025-11-19T09:26:11.5566667+00:00

    People are wondering why refreshAllDataConnections has been broken for so long. To me, the reason seems pretty obvious. Microsoft really doesn’t want us using Excel as a “middle tier” for pulling data from other sources. They’d much rather push us towards all the fancy connectors that can do the same thing in a more “official” way. The catch, of course, is that those connectors require a Premium license.

    Using Excel as a staging layer is effectively a workaround that avoids those Premium connectors (and the associated costs!) Breaking this path, while keeping the Premium route open, looks a lot like a deliberate push towards more expensive subscriptions and making previously working functionality unreliable or unusable. At best that’s questionable, but if you think it through, it’s pretty disgusting.

    So let’s not kid ourselves. I seriously doubt this function will ever be properly fixed. And now we’re seeing alternative routes, like Run script from SharePoint library, quietly stop working as well. Coincidence? Maybe. But it does fit the pattern.

    In the end, the choice is simple. Either swallow the Premium costs, or as an organisation start asking whether it still makes sense to keep pouring money into a company that clearly optimises for shareholders first, and for its actual users a distant second.

    Was this answer helpful?

    1 person found this answer helpful.

  2. Dung Thuy Nguyen 0 Reputation points
    2023-12-05T07:51:10.57+00:00

    Screenshot 2023-12-05 152414

    This might be the reason: Currently Excel Online does not support refreshing data sources from Power Queries. It seems that Excel for Web only allows Odata or table/range.

    If you build a new flow for Power Automate Desktop instead, it will be easier to consolidate Excel files

    Was this answer helpful?

    0 comments No comments

  3. Fabio Plos 0 Reputation points
    2023-10-17T23:28:24.3+00:00

    it seems that for now the only solution is:

    Select Data > Queries & Connections > Connections tab, right click a query in the list, and then select Properties.

    Click the Usage tab.

    1. Select the Refresh every check box, and then enter the number of minutes between each refresh operation.
    2. fyi 1440 minutes is one day
    3. repeat for all connections

    Was this answer helpful?

    0 comments No comments

  4. Tyler Graham 1 Reputation point
    2023-04-20T19:11:35.3633333+00:00

    I don't have an answer for this, but a possible workaround. I just changed my Run Script action from the now, apparently, defunct Refresh script to a script that simply changes the Worksheet's name. If whatever you're doing doesn't require a specific worksheet name, you can do this to force Power Automate to read the most recent values in your spreadsheet. Works for me in other flows where I previously had to run a 5 minute delay action to get Power Automate to recognize the new table.

    Was this answer helpful?


  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.

    Was this answer helpful?


Your answer

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