Skip to main content

Notifications

Power Automate - Using Connectors
Answered

Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

(0) ShareShare
ReportReport
Posted on by 48

Hello,

 

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().

 

As of wednesday may 10th I receive the below error message:

Office JS error: Line 4: Workbook refreshAllDataConnections: There was an internal error while processing the request. clientRequestId: a7b48e93-4b3b-4db6-93a2-56378d34dd67

-> the script does work within excel (or excel online) itself.

 

I had priorly had a similar problem as now. This was then resolved, but I think the issue has come back.

https://powerusers.microsoft.com/t5/Using-Connectors/Running-office-script-with-Workbook-refreshAllDataConnections/m-p/2117793#M18047

 

Do others have this issue as well?

 

 

EDIT:

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.

 

Thank you for the help.

  • takolota1 Profile Picture
    takolota1 4,781 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    If anyone needs a workaround, you can use this template set up to quickly update & create / sync datasources to standard Excel tables without power query:

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Excel-Batch-Create-Update-and-Upsert/td-p/1624706

  • retrohead Profile Picture
    retrohead 48 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    I believe only works with Power BI connections. Heavy DAX calculations or large amounts of data can still cause a failure.

  • TravisCB1 Profile Picture
    TravisCB1 63 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    No. What usually happens, is someone will come in here, ask "Any updates?" and someone will come in and say "Did you check the file size?" then there is back and forth about file size because most everyone is working with tiny single sheet workbooks.  Then someone says, "use powerbi," then there is back and forth about power bi, because many can't use PBI. Then someone says "it's not supposed to work" then there is back and forth about how it was working until last summer. Then the person who is from M$ will say they will look into it further and the thread goes quiet.  Then someone will ask "any updates" and some will say, "did you check the file size?" 

    ... And the circle of life of this thread begins again. 

  • Fabio_Alex Profile Picture
    Fabio_Alex 2 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    Hi,

     

    Is there any progress? Has anyone got any solution for this issue? I'm trying to run the script to refresh an Excel file (35 kB) on Sharepoint.

  • TravisCB1 Profile Picture
    TravisCB1 63 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    I am going to go try it again. My file are on OneDrive. I will activate the script that was working before all this started and see if it works again today and report back here. 

  • retrohead Profile Picture
    retrohead 48 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    @gbdawg82 just to be clear I have been using Sharepoint to store my Excel files and not tried OneDrive. Are you sure you have the correct access on the Sharepoint site as it seems odd it would work on one and not the other?

    I am setting up new flows now so everything seems to be working well again, I just hope it doesn't stop working again as I start to rely on this more and more.

  • gbdawg82 Profile Picture
    gbdawg82 12 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    I was able to get this working with files on OneDrive, but I have yet to get this to work on sharepoint

     

  • retrohead Profile Picture
    retrohead 48 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    @gbdawg82 the only connection method I don't have working is using DAX studio right now which is fair enough. 

     

    I tested Excel "Get data from power BI service" for you and that seems to be the same connection that is created using Anlayze in Excel so that is working for me too.

    The only advice I have is to stay away from using accessing measures directly by building a summarized flat table in the power BI report then pull this directly so no calculations need to happen during the refresh. This caused problems for me in the past with a large data set (700k records with multiple elements attached) but I resolved it by creating a table that already has the calculations done already as static numbers. The calculations are done when the dataset is refreshed ready for me to pull it into Excel.

  • TravisCB1 Profile Picture
    TravisCB1 63 on at
    Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    So are you saying that "Refresh All" for Excel on power automate should work now?

  • Re: Running office script with Workbook.refreshAllDataConnections() does not work when called from Power Automate

    Thanks, @TravisCB1 . As I mentioned to others, I would have responded sooner, but I was out ill. Let me know how things are running over the next day or so. Cheers!

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard

Featured topics