web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Office script to refre...
Power Automate
Suggested Answer

Office script to refresh all data connections of the workbook not working

(1) ShareShare
ReportReport
Posted on by 5
Hi experts,
I have used the Office script to refresh all data connections of the workbook. The workbook uses the OLEDB connection to the Power BI dataset.
 
function main(workbook: ExcelScript.Workbook) {
    workbook.refreshAllDataConnections();
}
 
But while running this script via Power Automate, I get the following error.
 
some hints please...
Categories:
I have the same question (0)
  • Suggested answer
    rzaneti Profile Picture
    4,491 Super User 2026 Season 1 on at
     
    Since you're trying to refresh a PBI connection, it should work: the refreshAllDataConnections method usually fails when called from Power Automate, except for PBI connection. 
     
    I found this old thread that is related to the same issue: https://community.powerplatform.com/forums/thread/details/?threadid=f7869112-0b26-47f9-b709-9e2befa916b6. According to the accepted answer, it looks like a temporary issue. 
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
  • stampcoin Profile Picture
    5,153 Super User 2026 Season 1 on at
    I don't think you can use OLEDB connection on excel online. (I might be wrong, I cannot find any doc that support OLEDB)
    If Power BI source doesn't belong to current tenant, you may consider using Odata query . for example.
     
  • Ganesha B Profile Picture
    5 on at
    Hi All,
    thanks for all your response.
     
    I saw this documentation, and it states that Workbook.refreshAllDataConnections only refreshes when PowerBI is the source. 
     
    I also use the PowerBI dataset with the OLEDB connection. So I guess it should support in my case. Any suggestion here?
     
    Regards,
    Ganesha
     
     
  • Suggested answer
    rzaneti Profile Picture
    4,491 Super User 2026 Season 1 on at
     
    Your conclusion is correct: the general rule for the refreshAllDataConnections is not to work from Power Automate, except when the connection has PBI as source. So it should work for your case, in my understanding. 
     
    I'm not very familiar with the connection between PBI and Excel for loading data to the spreadsheets, but I wonder if there are any other methods besides the OLEDB to perform this connection. If yes, this might be the problem: PBI works with these alternative methods, but not with OLEDB. 
     
    Anyway, the Office Scripts development team is very active in GitHub, so I recommend you to open an issue there to share about this problem. Eventually they can recommend some workaround. You can open the issue here: https://github.com/OfficeDev/office-scripts-docs/issues?q=is%3Aissue%20state%3Aopen
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
  • Ganesha B Profile Picture
    5 on at

    The workflow is again start continuously failing since June 19th, without any success. I have tried multiple times, but I am still encountering the same error. Any hint?.

    Office JS error: Line 2: Workbook refreshAllDataConnections: There was an internal error while processing the request.
    clientRequestId: b0b8bb1f-54b8-4079-8034-3e678d6f5f25

    Thanks in advance.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard