# Refresh Excel Online data connections on a schedule

> For the full documentation index, see https://250highstreet.com/llms.txt

> Microsoft says a script run from Power Automate does not refresh data connections except Power BI sources. Here is what is documented and what to do instead.

Short answer: do not count on an Office Script inside a Power Automate flow to refresh your workbook. Microsoft's page says the refreshAllDataConnections method "Only refreshes PowerBI sources. For other sources, the method returns successfully but does nothing." The flow shows green and the data stays old.

## The trap: green run, old data

Microsoft's troubleshooting page for Office Scripts in Power Automate says a few methods "do nothing in a script when called through Power Automate. They still return successfully and don't throw any errors." The list is PivotTable refresh, Workbook refreshAllPivotTables and Worksheet refreshAllPivotTables.

So a scheduled flow with a Run script step can finish with a success mark and change nothing. Open the workbook after a run and check the data and the last refresh, not only the run history.

The same page says: "Power Automate doesn't trigger a data refresh for formulas that use workbook links."

## What does work in the browser

Microsoft's Power Query page for Excel for the web says you can refresh all data sources: "select Data \> Refresh All." The page lists these import sources: "Excel workbook, Text/CSV, XML, JSON, SQL Server database, SharePoint Online list, OData, Blank table, and Blank query." Viewing and refreshing queries is available to all Microsoft 365 subscribers; Microsoft says more functionality needs a Business plan or an Enterprise plan (E3 and above).

When a refresh needs sign-in, the page says you can choose anonymous, user and password, or your organizational account. It also says your browser needs third-party cookies enabled for some Power Query features in Excel for the web.

That refresh is a person clicking in a browser. It is not a schedule.

## What Microsoft documents for a schedule

Microsoft's Office Scripts overview says: "Script scheduling is temporarily disabled within Office Scripts. Existing scheduled scripts will continue to run." It points to Power Automate: create a flow and schedule your scripts in that flow.

Power Automate runs the Excel Online (Business) connector action Run script. Microsoft says to use a business license of Microsoft 365 for Office Scripts in Power Automate.

That path works for script work such as adding rows, formatting and returning values. It is the refresh step that Microsoft says only works for Power BI sources.

## Step 1. Decide where the data really lives

Ask where the workbook gets its numbers.

1.  If the numbers come from a SharePoint list, you may not need a refresh. A flow can read the list and write rows into an Excel table with the Excel Online (Business) connector, and a script can place them. See "[Add a row to an Excel table fails in Power Automate](/guides/power-automate-add-row-to-excel-table-fails/)".
2.  If the numbers come from Power BI, Microsoft says the refreshAllDataConnections method refreshes PowerBI sources in a flow. Our advice, not a Microsoft rule: test it on a copy first.
3.  If the numbers come from a Power Query source such as a database or web page, Microsoft's page says refreshAllDataConnections does nothing for that source in a flow. Use the browser refresh or a different design.

## Step 2. Test a scheduled flow on a copy

Our advice, not a Microsoft rule: never test on the real workbook.

1.  Copy the workbook. Add a note cell with the text "test".
2.  In Power Automate, create a Scheduled cloud flow.
3.  Add Run script from the Excel Online (Business) connector. Pick the copy and the script.
4.  Run the flow once.
5.  Open the copy. Check whether the data changed. Do not rely on the green run mark.

## Step 3. If the data did not change

Move the work out of the script. Our advice, not a Microsoft rule:

- Keep the data in a SharePoint list and build the report from the list. See "[Connect a SharePoint list to a Power BI dashboard](/guides/sharepoint-list-to-power-bi-dashboard/)".
- Have the flow write new rows into a plain Excel table, so no refresh is needed.

If Excel Online will not let you edit a workbook, see "[Cannot edit an Excel file in the browser](/guides/excel-online-cannot-edit/)".

## When to get help

You can build all of this yourself in Microsoft 365. If you would rather have it built and tested for your team, I do that. A tracker like this is a fixed price: \$5,000 for one, built in 2 weeks. See "[What a SharePoint tracker costs to build](/guides/what-a-sharepoint-tracker-costs/)". Bring one example of the problem to a free call.

I am Al Davies. I run 250 High Street LLC and build SharePoint trackers and Power Automate flows for operations teams. I work remotely. The first call is free, and I will not try to sell you anything.

See trackers I built: [Tools I built](/portfolio/)

## FAQ

### Can Power Automate refresh an Excel Online workbook on a schedule?

A flow can run on a schedule, but Microsoft says a script in a flow only refreshes Power BI sources.

### Why does my Excel script run in Power Automate but the data is old?

Microsoft says some refresh methods return successfully and do nothing when called through Power Automate.

### How do I refresh a data connection in Excel for the web?

Select Data, then Refresh All, per Microsoft's Power Query page for Excel for the web.

### Can Office Scripts schedule a script without Power Automate?

Microsoft says script scheduling is temporarily disabled and points to scheduling the script in a Power Automate flow.

### Which Excel Online refresh method works in a flow?

Microsoft says Workbook refreshAllDataConnections only refreshes PowerBI sources.

## Sources

- [Microsoft Learn, Troubleshoot Office Scripts running in Power Automate - Office Scripts](https://learn.microsoft.com/en-us/office/dev/scripts/testing/power-automate-troubleshooting)
- [Microsoft Learn, Run Office Scripts with Power Automate - Office Scripts](https://learn.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration)
- [Microsoft Learn, Office Scripts in Excel - Office Scripts](https://learn.microsoft.com/en-us/office/dev/scripts/overview/excel)
- [Microsoft Learn, Troubleshoot Office Scripts - Office Scripts](https://learn.microsoft.com/en-us/office/dev/scripts/testing/troubleshooting)
- [Microsoft Support, Use Power Query in Excel for the Web](https://support.microsoft.com/en-us/office/use-power-query-in-excel-for-the-web-02652946-de70-48d8-8a34-3db96998ff5a)

## Related guides

- [Add a dropdown list in Excel Online](/guides/excel-online-data-validation-dropdown/)
- [Project Online is retired: what a small team can use instead](/guides/project-online-retired-what-small-teams-use-instead/)
- [Filter Excel Online without changing it for everyone](/guides/excel-online-sheet-view/)

Source: https://250highstreet.com/guides/excel-online-refresh-data-connections-schedule/
