Hello everyone! Can anyone help me, I have been working on a project. I want to update/refresh the data of the power query table in excel using office scripts then trigger it via recurrence in power automate cloud. However, the datas are not being updated/ refreshed when using run script action. I'm kinda stuck in this situation. Thank you for your help in advance!
You can refresh Power Query data in Excel using Power Automate and Office Scripts, but there are a few key points to make it work:
The Run Script action in Power Automate only executes the code in your Office Script.
If your script doesn’t explicitly call the refresh method for the query tables, the data won’t update.
Power Query refresh in Excel online requires the workbook to be open and the script to handle the refresh.
Update Your Office Script
Make sure your script includes something like:
function main(workbook: ExcelScript.Workbook) {
// Refresh all queries
workbook.refreshAllDataConnections();
}
Set Up Power Automate Flow
Use Recurrence trigger (e.g., daily or hourly).
Add Run Script action:
Select your Excel file stored in OneDrive or SharePoint.
Choose the script you created above.
(Optional) Add Send Email or Teams notification to confirm refresh.
Was this reply helpful?YesNo
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.