To schedule an Excel query refresh, you can use the built-in Connection Properties for simple timed intervals or use Power Automate and Windows Task Scheduler for complex, fully automated schedules. This process ensures your reports always display the most current data from your source—whether that is a SQL database, a web page, or another Excel file—without requiring you to manually click the Refresh button every time you open the workbook.
What You'll Need
- Microsoft Excel (Power Query enabled).
- An established data connection (Query) already imported into your workbook.
- Administrative access to your computer if using Windows Task Scheduler.
- A Microsoft 365 account if utilizing Power Automate for cloud-based refreshes.
- Consistent access to the data source (VPN or network connection) during the scheduled time.
Step-by-Step
Depending on your needs, there are three primary ways to handle refreshes. Labels and menu paths may vary slightly depending on your version of Excel or your region.
Method 1: Built-in Timed Refreshes (Internal)
This is the easiest method and works while the workbook is open. It is ideal for dashboards that stay open on a monitor throughout the day.
- Open your Excel workbook and navigate to the Data tab on the top ribbon.
- Click on Queries & Connections. This will open a pane on the right side of your screen listing all active queries.
- Right-click on the specific query you wish to schedule and select Properties.
- In the Query Properties dialog box, locate the Usage tab.
- Check the box labeled Refresh every ___ minutes and enter your desired time interval (e.g., 60 for hourly).
- Check the box labeled Refresh data when opening the file if you want the latest data immediately upon launch.
- Click OK to save the settings.
Method 2: Using Power Automate (Cloud-Based)
If your file is stored in OneDrive for Business or SharePoint, you can trigger refreshes without having the file open on your desktop.
- Log into your Power Automate account via your web browser.
- Select Create from the left-hand menu and choose Scheduled cloud flow.
- Give your flow a name and set the starting date and the recurrence interval (e.g., once a day at 8:00 AM).
- In the flow designer, click New step and search for the Excel Online (Business) connector.
- Select the action Refresh a Power BI dataset or, if using a linked table, use the Update a row or specific script actions to trigger a data pull. (Note: Full Excel query refresh via Power Automate often requires the file to be converted to a Power BI dataset or using an Office Script).
- Save the flow and test it using the Test button in the top right corner.
Method 3: Windows Task Scheduler with VBA (Advanced)
For local files that need to refresh at a specific time without user intervention, you can combine a VBA macro with the Windows Task Scheduler.
- Open your workbook and press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
- Go to Insert > Module and paste a code snippet that calls
ActiveWorkbook.RefreshAlland thenActiveWorkbook.Save. - Save the file as an Excel Macro-Enabled Workbook (.xlsm).
- Open the Windows Task Scheduler from your Start menu.
- Click Create Basic Task and name it "Excel Refresh".
- Set the Trigger (Daily, Weekly, etc.) and the specific time.
- For the Action, select Start a program.
- In the Program/script box, browse to the location of your
excel.exe(usually found in C:\Program Files\Microsoft Office\root\OfficeXX). - In the Add arguments box, enter the full file path to your .xlsm workbook in quotes.
- Finish the wizard. Now, Windows will launch Excel and run the macro at the scheduled time.
Common Mistakes
One of the most frequent errors is forgetting to disable "Background Refresh." By default, Excel refreshes queries in the background, meaning the rest of the workbook continues to run while the data loads. While this sounds helpful, if you have a VBA macro or a scheduled task that saves the file immediately after the refresh command, the file may save before the data has actually finished downloading. This results in the file saving old data. To fix this, go to Query Properties and uncheck Enable background refresh. This forces Excel to wait until the data is fully loaded before moving to the next step.
Another common mistake is failing to account for credentials. If your query connects to a database or a web API that requires a password, the scheduled refresh will fail if the credentials are not stored securely in the Data Source Settings. If the query prompts for a login every time it runs, a scheduled task will simply hang in the background indefinitely because there is no user to enter the password.
Finally, users often schedule refreshes for files stored on local drives that go to sleep. If your computer is in Hibernation or Sleep mode, Windows Task Scheduler cannot launch Excel, and the internal "Refresh every X minutes" timer stops because the application is not active.
Tips
To optimize performance, avoid scheduling every single query in a large workbook to refresh at the same time. If you have ten different queries pulling from ten different websites, your network bandwidth may spike, or the source server might temporarily block your IP address for making too many requests. Instead, stagger your refreshes or combine multiple queries into one using the Append or Merge features in Power Query.
For those using shared workbooks on SharePoint, always ensure that the Privacy Levels are set correctly. If one query pulls from a local file and another pulls from a cloud database, Excel may block the refresh due to "Formula.Firewall" errors. Setting the privacy levels to "Organizational" or "Public" in Data > Get Data > Query Options > Privacy can resolve these conflicts.
If you are using the VBA method, add a line of code to close the workbook after the save command. If you don't, you will find dozens of invisible instances of Excel running in your Task Manager after a few days of scheduled refreshes, which will eventually slow your computer to a crawl.
Troubleshooting
If your scheduled refresh is not working, start with the simplest check: manually click Refresh All. If the manual refresh fails, the issue is with the data source, the file path, or the credentials, not the schedule. Check for any "Expression.Error" messages in the Power Query editor.
If manual refresh works but the scheduled task does not, check the Windows Task Scheduler history. Look for Result Code 0x1 or similar errors. This usually indicates that Excel was unable to find the file path or that a pop-up window (like a "Update Links" warning) is blocking the process. To stop these pop-ups, go to File > Options > Advanced and under the General section, uncheck Show alerts and notifications.
If the data is refreshing but the values aren't changing, verify that the source data is actually updating. If you are pulling from a web page, check if the site has implemented a CAPTCHA or a new login requirement that prevents Power Query from accessing the HTML content.
For cloud-based refreshes that fail, check the Power Automate run history. It will tell you exactly which step failed. Often, the issue is a "Locked File" error, which happens if another user has the Excel file open in a way that prevents the service from writing new data to the cells.
Frequently Asked Questions
Can I schedule a refresh if my computer is turned off?
No, if the file is stored locally and you are using internal settings or Task Scheduler. However, if the file is stored in OneDrive/SharePoint and you use Power Automate or Power BI, the refresh happens on Microsoft's servers and does not require your PC to be on.
Will a scheduled refresh overwrite my manual changes?
If you have typed manual data into the cells where the query outputs its table, those changes will likely be overwritten or shifted when the query refreshes. Always keep your manual input in a separate table and use Power Query to merge it with the refreshed data.
Does scheduling a refresh slow down my Excel performance?
Yes, during the actual refresh process, you may notice a lag in responsiveness, especially if "Background Refresh" is disabled. Scheduling these tasks during off-peak hours is recommended for very large datasets.
How do I stop a refresh that is taking too long?
You can click the small "X" or cancel button in the status bar at the bottom right of the Excel window where the "Running Background Query" message appears. If Excel is frozen, you will need to use Ctrl + Shift + Esc to end the Excel process via Task Manager.
Can I schedule different queries to refresh at different times?
Yes. By right-clicking individual queries in the Queries & Connections pane, you can set unique intervals for each one rather than using the global Refresh All command.