Skip to main content
Community site session details

Community site session details

Session Id : qBXJZlMsfgZV7rEPtv0aSw
Power Automate - Using Connectors
Answered

Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

Like (5) ShareShare
ReportReport
Posted on 19 Apr 2023 15:12:36 by 48

Hi,

 

I use Power automate to refresh an excel table that is connected to Power BI every day.

This is via a 'Run Script' prompt that refers to a script containing Workbook.refreshAllDataConnections().

 

This has always functioned very well. However, as of today, I receive the below error.

Has Microsoft changed the possibility to use Workbook.refreshAllDataConnections() or might there be something else?

 

The error message:

"We were unable to run the script. Please try again.
Runtime error: Line 5: Workbook.refreshAllDataConnections() is not supported in Power Automate.
clientRequestId: 566bd94c-36fd-4090-aa5c-cc47459f3b53"

  • MF-05091302-0 Profile Picture
    7 on 05 Sep 2024 at 13:08:21
    Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error
    Has this issue come back again? I have a flow that has been running fine for over a year, then 2 days ago I started receiving this same error message.
    I have isolated it to only run a simple refresh in my script to be sure:
     
    workbook.refreshAllDataConnections();
     
     
    And this is what I get: "Action 'Run_script' failed: We were unable to run the script. Please try again. Office JS error: Line 3: Workbook refreshAllDataConnections"
  • RodolpheF Profile Picture
    6 on 05 Apr 2024 at 07:26:29
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    Please this topic is everything but not solved! This is missleading and unfair for those who need this particular but essential feature! 

  • RodolpheF Profile Picture
    6 on 05 Apr 2024 at 07:20:42
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    Hi Yutao,
    It's been almost a year! Where have we been with this issue? Refreshalldataconnections is key in script with Power Automate... How Microsoft can miss that! We need it please! 
    When you say "only Power BI connections", will you exclude Power Query in Excel? Both are in DAX languages and almost the same queries though... 

  • joachimmoens Profile Picture
    48 on 14 Jun 2023 at 06:39:31
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    AS OF MONDAY 15TH MAY I HAVE NO ERROR MESSAGE ANYMORE. HOWEVER THE REFRESH SIMPLY DOESN'T PERFORM A REFRESH. THE SCRIPT DOES WORK FINE WHEN IT IS NOT CALLED FROM POWER AUTOMATE.

     

    New issue created: https://powerusers.microsoft.com/t5/Using-Connectors/Running-office-script-with-Workbook-refreshAllDataConnections/td-p/2153099

  • joachimmoens Profile Picture
    48 on 15 May 2023 at 06:41:44
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    It seems that this has been resolved for a while, but a bug has come back for refreshing a PowerBI connection with workbook.refreshAllDataConnections

     

    Workbook refreshAllDataConnections: There was an internal error while processing the request.

  • Verified answer
    Yutao Huang Profile Picture
    Microsoft Employee on 24 Apr 2023 at 15:59:53
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    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!

     

    P.S.: Just to be clear, currently only the Power BI data connections can be refreshed through the workbook.refreshAllDataConnections() API. We have been working to support refreshing the other data connection types, but currently we don't have a concrete timeline to share yet. Thanks again for your patience and support!

  • joachimmoens Profile Picture
    48 on 21 Apr 2023 at 06:53:18
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    The solutions proposed in the other thread do not work for me either. I think the command is debunk, but I do not know if Power is planning to fix the issue.

  • RPeralta160 Profile Picture
    2 on 20 Apr 2023 at 18:40:05
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    Hello,

     

    Did you find any solution to this problem?
    I'm getting the same issue, and i can't find the "Refresh Workbook" in Power Automate

  • joachimmoens Profile Picture
    48 on 20 Apr 2023 at 08:46:06
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    I have just found another thread (that was also created yesterday) that refers to the same issue and has a proposed solution.

    https://learn.microsoft.com/en-us/answers/questions/1250098/workbook-refreshalldataconnections()-is-not-suppor

  • BTAPA Profile Picture
    20 on 19 Apr 2023 at 23:28:48
    Re: Running office script with Workbook.refreshAllDataConnections() has suddenly returned an error

    I'm getting the same error. Flow worked fine up until today.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1

Featured topics

Loading complete