Power Query Problems

How to Refresh Power Query in SharePoint Excel Without Opening It

Muhammad TalhaMuhammad Talha Nov 11, 2026 869 views

Question details

The user wants to automatically refresh Power Query data in an Excel workbook stored on SharePoint without having to open the file manually.

How to Refresh Power Query in a SharePoint Excel File Without Opening It
Product
Microsoft Excel, SharePoint, Power Automate
Device & OS
not provided
Scenario
A new source row is added to the data, requiring an automatic update of the Power Query results.
Observed behavior
Currently, the user has to open the Excel file manually to trigger a Power Query refresh, and is looking for an automated background solution.
Before you start

Ensure you have the necessary permissions to edit the Excel file on SharePoint and access to Power Automate or PowerShell to set up automated scripts.

Solution 1Recommended

Use Power Automate and an Office Script

Ideal if Power Automate is already adding new rows and your data source is within the same Excel file.

This method uses an Office Script to trigger the 'RefreshAll' command via Power Automate. Note that Excel for the web currently does not support refreshing Power Query connections that rely on external data sources.

1
Create the Office Script

Open the Excel file in your web browser, navigate to the 'Automate' tab on the ribbon, create a new script, and add the code: workbook.refreshAllDataConnections();

2
Set up a Power Automate Flow

Log into Power Automate and create an automated cloud flow that triggers whenever a new row is added to your source data.

3
Add the Run Script Action

Add the 'Run script' action under the Excel Online (Business) connector to your flow. Select your SharePoint site, document library, the specific Excel file, and the Office Script you just created.

Use Power Automate and an Office Script
Limitation for External Data: This solution only works if your Power Query data source is internal (within the same file). External data refreshes are not supported by Excel Online scripts.
Free Microsoft Office alternative

Try WPS Office for Seamless Data Management

While complex background automation with SharePoint requires specific Microsoft tools, WPS Office provides a free, lightweight, and highly compatible alternative for everyday spreadsheet tasks. Enjoy a familiar interface and robust data processing tools without the hefty subscription fees.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
  2. 2. Install the software: Run the downloaded installer and follow the on-screen instructions to set up WPS Office on your device.
  3. 3. Open your spreadsheets: Launch WPS Spreadsheet and open your existing Excel files to continue working seamlessly with high format compatibility.
Highly compatible with Microsoft Excel (.xlsx, .xls) file formatsLightweight application that runs smoothly even on older devicesBuilt-in advanced data analysis and visualization toolsFree to use with a familiar, easy-to-navigate interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Office Script RefreshAll fail for external data?

Excel for the Web currently does not support refreshing Power Query connections that pull data from external sources. The RefreshAll method via Office Scripts only works if the data source is contained entirely within the same workbook.

Can I use Power Automate to refresh Excel desktop?

Power Automate cloud flows primarily interact with Excel Online. To automate the desktop version of Excel for external data refreshes, you would need to use Power Automate Desktop (RPA) or a scheduled PowerShell script on a machine where Excel is installed.

Does the SharePoint file need to be synced locally for the PowerShell method?

Yes, typically the PowerShell COM object method requires the SharePoint document library to be synced to your local machine or server via OneDrive, as it relies on the local Excel desktop application to open the file and perform the refresh.