Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Auto Refresh Power Query: How to Set It Up

· 7 min read · Home Tech

In this article
  1. What Is Power Query Auto-Refresh?
  2. How to Set Up Auto-Refresh in Excel
  3. Auto-Refresh for Web and Database Queries
  4. How to Choose the Right Refresh Method
  5. Common Problems and Fixes
  6. Power Query vs. Traditional Connections
  7. Costs and Limitations of Auto-Refresh
  8. Alternatives to Built-In Auto-Refresh
  9. Frequently Asked Questions

Yes, Power Query in Excel can auto-refresh, but the method depends on your data source and whether you use Excel 365, Excel 2021, or an older version. For most users, the simplest way is to set the query to refresh when the file opens or at a timed interval using the Data tab's Queries & Connections pane. This article explains the options, how to configure them, and common pitfalls to avoid.

What Is Power Query Auto-Refresh?

Power Query is Excel's data transformation engine. When you import data from a file, database, or web source, Power Query creates a query that can be refreshed to pull updated data. Auto-refresh means Excel automatically runs that query at a scheduled time or when a specific event occurs, without you manually clicking Refresh. This is distinct from a one-time manual refresh, which you trigger by pressing Ctrl+Alt+F5 or using the Refresh button on the Data tab.

How to Set Up Auto-Refresh in Excel

The steps vary slightly depending on your Excel version, but the core process is the same. Here's how to configure auto-refresh for a query that already exists.

  1. Go to the Data tab and click Queries & Connections (or Show Queries in older versions).
  2. In the Queries & Connections pane, right-click your query name and select Properties.
  3. In the Usage tab, check the box for Refresh data when opening the file if you want the query to refresh every time you open the workbook.
  4. Check Refresh every and enter a number of minutes (e.g., 15) to set a timed refresh interval. This option is only available for certain data sources, like SQL Server or OData, and it works only while the workbook is open.
  5. If you want the query to refresh in the background while you continue working, keep Enable background refresh checked.

For data sources that don't support timed refresh (like CSV or Excel files), you can still use the “Refresh when opening the file” option. To refresh at a specific time of day, you'd need a macro or a third-party tool, as Excel's built-in scheduler doesn't support that.

Auto-Refresh for Web and Database Queries

Power Query can connect to many sources, but auto-refresh behavior depends on the source type.

  • SQL Server, Oracle, and other databases: These support both “refresh when opening” and “refresh every” intervals. The timed refresh uses the connection's credentials and runs in the background.
  • Web sources (e.g., APIs, HTML tables): These generally support timed refresh, but be aware that some websites block automated requests. If your query fails, check the website's terms of service.
  • Local files (Excel, CSV, text): These only support “refresh when opening the file.” There's no timed refresh because Excel assumes the file is static while you work.
  • SharePoint and OneDrive: These can refresh on a schedule, but you may need to use Power Automate or a data gateway for cloud-based scheduling.

If you use Excel Online (the web version), auto-refresh options are limited. You can manually refresh, but timed refresh is not available. For a fully automated schedule, you'd need Power Automate or a Power BI dataset.

How to Choose the Right Refresh Method

Selecting the correct method depends on how often your data changes and how you use the workbook.

  • For a daily report that you open each morning: Use “Refresh when opening the file.” It ensures you always see the latest data when you start work.
  • For a live dashboard that you keep open all day: Use a timed refresh every 10-30 minutes. This keeps the data fresh without manual intervention, but it can slow down Excel if the query is heavy.
  • For a one-time data pull: Just use manual refresh. Auto-refresh isn't needed and could cause unnecessary load.
  • For data that updates in real time (e.g., stock prices): Timed refresh is your best bet, but consider using a streaming data source if available.

A common mistake is enabling both “refresh when opening” and a timed interval. That's fine, but it means the data will refresh immediately on open, then again after the interval. If the query is slow, this can make the file feel sluggish.

Common Problems and Fixes

Auto-refresh sometimes fails, and the causes are usually straightforward.

  • “Refresh every” is grayed out: This happens when your data source doesn't support timed refresh. Check if you're using a file-based source. If so, switch to “refresh when opening” or use a database connection.
  • Queries don't refresh when the file opens: Excel may be blocking background refresh due to privacy settings. Go to File > Options > Trust Center > Trust Center Settings > Privacy Options, and ensure “Allow background refresh” is enabled.
  • Refresh takes too long: Large datasets or complex transformations can slow down Excel. Consider loading the query to the Data Model instead of a worksheet, or reduce the number of rows.
  • Credentials prompt appears every time: If your data source requires authentication, save the credentials in the query settings. Right-click the query, choose Properties, and under the Definition tab, check “Save password” if available.
  • Auto-refresh stops after a while: Excel may stop refreshing if the workbook is idle for a long period or if the system enters sleep mode. This is by design; there's no built-in way to keep refreshing during sleep.

Power Query vs. Traditional Connections

Before Power Query, Excel had “connections” to external data (like SQL Server) that also supported auto-refresh. The difference is that Power Query adds a transformation layer. With a traditional connection, you import raw data directly. With Power Query, you can clean and reshape the data before it lands in your sheet. Both support auto-refresh, but Power Query is more flexible and is the recommended approach for new workbooks.

One key difference: traditional connections can refresh on a timer even when the workbook is closed, if you use a shared data source and the file is stored on a server. Power Query, however, only refreshes when the file is open (unless you use Power Automate or a gateway). So if you need scheduled refresh without opening the file, you'll need additional tools.

Costs and Limitations of Auto-Refresh

Excel's built-in auto-refresh is free, but there are practical limits. Timed refresh can consume CPU and memory, especially with large queries. If you have many queries, Excel may become unresponsive. Also, auto-refresh only works while the workbook is open. If you close the file, no refresh happens.

For cloud-based scheduling (e.g., refreshing a workbook stored in OneDrive at 2 AM), you need Power Automate, which has a free tier but also paid plans. Power BI offers more robust scheduling, but it's a separate product. For most users, the built-in options are sufficient.

Alternatives to Built-In Auto-Refresh

If Excel's native options don't meet your needs, consider these alternatives:

  • VBA macros: You can write a macro that refreshes queries at a specific time using Application.OnTime. This gives you more control, but it requires coding and the workbook must be open.
  • Power Automate: Create a flow that opens the workbook, refreshes, and saves it. This works even when you're away, but it requires a Microsoft 365 subscription.
  • Power BI: If you need scheduled refresh for a dashboard, Power BI has a built-in scheduler. You can publish your Excel data to Power BI and set a refresh schedule.
  • Third-party add-ins: Some add-ins offer advanced scheduling, but be cautious about security and compatibility.

Each alternative has trade-offs in cost, complexity, and reliability. For most people, the built-in options are enough.

Frequently Asked Questions

Can I make Power Query refresh every hour automatically? Yes, if your data source supports timed refresh. In the query Properties, check “Refresh every” and set it to 60 minutes. This works while the workbook is open.

Why doesn't my Excel query refresh when I open the file? Check that the “Refresh data when opening the file” box is checked in the query Properties. Also, ensure that background refresh is enabled in Trust Center settings. If the file is in a shared location, you may need to change privacy settings to ignore privacy checks.

Does auto-refresh work in Excel Online? No, Excel Online does not support timed refresh. You can manually refresh, but for automation, you'd need Power Automate or a desktop version of Excel.

Will auto-refresh slow down my computer? It can, especially if the query is large or runs frequently. To minimize impact, use background refresh, reduce the refresh frequency, or optimize your query by removing unnecessary columns and rows.

Can I set different refresh intervals for different queries? Yes, each query has its own Properties dialog. You can set different intervals for each query, but be aware that too many simultaneous refreshes can cause performance issues.

Is there a way to refresh Power Query without opening Excel? Not with built-in features. You'd need Power Automate or a script that opens Excel and triggers a refresh. Alternatively, use Power BI for scheduled refresh.