Excel Scripts "Refresh All" function not working for Excel Online

Keiran 0 Reputation points
2024-10-09T22:21:39.6866667+00:00

I have recorded a very basic Office script, as below: function main(workbook: ExcelScript.Workbook) {

  // Refresh all data connections

  workbook.refreshAllDataConnections();

}

It refuses to refresh the Power Query data that is coming from 2 tables within the same workbook.

It works perfectly on the desktop version of Excel, but not on the Online version. When i manually select "Refresh All" on Excel Online, it works perfectly fine. What gives? I thought the whole point of Office scripts was to allow it to work online?

Anyone have any guidance?

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,861 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,111 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jiajing Hua-MFST 13,780 Reputation points Microsoft Vendor
    2024-10-10T06:56:53.6+00:00

    Hi @KeiranDo you refresh this workbook with the Office Script to update the Queries and reuse the Query in Power Automate?

    Please note, refresh not fully supported in Power Automate. Office Scripts can't refresh most data when run in Power Automate, Workbook.refreshAllDataConnections only refreshes when PowerBI is the source.

    For more, please refer to this link: https://learn.microsoft.com/en-us/office/dev/scripts/testing/power-automate-troubleshooting#refresh-not-fully-supported-in-power-automate


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



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.