Forum Discussion
Office Scripts does not refresh Power BI Query live connections in Excel Online
Hi, Siminio.
The comparison with the manual Refresh All action is important here. It shows that the workbook, the Power BI connection, and the signed-in user can refresh successfully. Since the same script also fails when run directly from Excel Online, this does not look like a Power Automate scheduling or authentication problem.
refreshAllDataConnections() does not reproduce every part of the manual Refresh All command in Excel for the web. A successful script run only means that the method returned without an error; it does not confirm that the Power BI live connection was actually refreshed.
A useful test is to create a new blank workbook, add the same Power BI semantic model connection, and run only the one-line script there. If it also fails, this provides a clear minimal example. Recalculation will not resolve the problem, because recalculating formulas does not force a Power BI connection to refresh.
For now, manual refresh is the reliable workaround. If an unattended process is essential, consider refreshing the Power BI semantic model on a schedule and then using Power Automate or a supported Power BI API to place the required data into an Excel table. This is different from an Analyze in Excel live connection, but it avoids relying on the Office Scripts refresh behavior. Refreshing the semantic model alone will not update the cached data in the workbook.
This should be raised with Microsoft as a potential regression or product limitation. Hopefully, the details above help identify the issue.