Creating a query table in Excel lets you import and refresh live data from external sources like databases, web pages, or text files without manually copying and pasting. This automates updates and keeps your analysis current. You need Excel 2010 or later and an accessible data source — such as a URL, database connection, or CSV file.

What You'll Need

  • Microsoft Excel 2010 or later (Excel 365 recommended)
  • A valid data source: a web page, text file (CSV/TXT), database (SQL, Access), or Excel workbook
  • Internet connection (if pulling from a website or online database)
  • Permissions to access the data source (e.g., login credentials for a database)

Step-by-Step

  1. Open Excel and create a new blank workbook or open an existing one where you want the query table.
  2. Go to the Data tab on the Ribbon. In the Get & Transform Data group, click From Table/Range if your data is already in Excel, or click From Web, From Text/CSV, From Database, or another source depending on where your data resides.
  3. If selecting From Web, paste the full URL of the webpage containing the table into the dialog box and click OK. Excel will load a preview of all tables found on the page. Select the table you want and click Load or Transform Data if you need to clean it first.
  4. If selecting From Text/CSV, browse to your file, select it, and click Import. The Power Query Editor will open, showing your raw data. Use the toolbar to remove columns, change data types, filter rows, or split text — then click Close & Load to bring the cleaned data into Excel.
  5. If selecting From Database (e.g., SQL Server, Access), enter the server name and database name, choose authentication method, then select the table or write a SQL query. Click OK, then Load or Transform Data as needed.
  6. After clicking Load, Excel creates a query table with headers and data in a new worksheet or existing sheet. The table is now connected to the source.
  7. To refresh the data later, right-click any cell in the table and select Refresh, or go to Data > Refresh All. You can also set automatic refresh under Data > Queries & Connections > right-click the query > Properties > refresh every X minutes.
  8. To edit the query later, go to Data > Queries & Connections, right-click the query name, and select Edit to reopen the Power Query Editor.

Common Mistakes

  • Trying to import from a webpage that requires login — Excel can’t authenticate sessions, so you’ll get an error. Use a public URL or export data to CSV first.
  • Not checking for hidden characters or inconsistent delimiters in CSV files, which can misalign columns. Always preview in Power Query Editor before loading.
  • Assuming Excel will auto-detect data types correctly — numbers stored as text will break calculations. Use the Power Query Editor to convert columns to Number, Date, or Currency explicitly.
  • Refreshing without saving the workbook first — if the source file is moved or renamed, the connection breaks and won’t refresh properly.
  • Using a dynamic URL (e.g., one with timestamps or parameters) that changes each time — this prevents Excel from recognizing it as the same source. Use a static URL or parameterize it properly in Power Query.

Tips

  • Use Transform Data instead of Load when your data needs cleaning — it opens the Power Query Editor where you can remove duplicates, split columns, or pivot/unpivot data.
  • Name your queries clearly (right-click in Queries & Connections > Rename) so you can find them later — e.g., “SalesData_2024” instead of “Query1”.
  • Store large query tables in separate sheets to avoid slowing down your workbook. Use Excel Tables (Ctrl+T) for better formatting and structured references.
  • For recurring reports, schedule automatic refreshes: Data > Queries & Connections > Properties > enable refresh on open and set time intervals.
  • If your source is a folder of multiple CSVs, use From Folder under Get Data to combine them into one table automatically.

Troubleshooting

  • Connection fails with “The data source could not be found” — verify the file path or URL is still valid. If the file was moved, update the connection via Data > Queries & Connections > right-click query > Properties > Source.
  • Refreshing takes too long or times out — reduce the data size by filtering rows in Power Query before loading. Avoid importing entire large tables; use SQL queries to pull only needed columns.
  • Data appears as #NAME? or #REF! — this usually means a formula in your sheet references a column that was renamed or removed in the query. Refresh the query or update formulas to match current column headers.
  • Power Query Editor won’t open — restart Excel. If the issue persists, check if the Power Query add-in is disabled: File > Options > Add-ins > Manage COM Add-ins > ensure “Microsoft Power Query for Excel” is checked.
  • Changes to source data don’t reflect — ensure the source file hasn’t been locked by another program, or the web page structure changed (e.g., site redesign). Re-import or adjust the query steps to match the new format.

Frequently Asked Questions

Can I use a query table with Excel Online?

No. Query tables and Power Query are not supported in Excel for the web. You must use the desktop version of Excel to create or edit them.

Can I combine data from multiple sources into one query table?

Yes. In Power Query Editor, use the Append Queries feature to combine tables from different sources — such as merging a CSV of sales data with a database of customer info — into a single unified table.

Do query tables update automatically when I open the file?

By default, no. You must enable automatic refresh in the query properties: right-click the query in Queries & Connections > Properties > check “Refresh data when opening the file.”

What happens if the source file is deleted or moved?

Excel will show an error on refresh. You must either restore the file to its original location or update the data source path in the query properties.

Can I password-protect a query table’s data source?

No. Excel cannot store or transmit passwords securely for external sources like databases. Use trusted connections or export data to a local file instead.

Is there a limit to how much data a query table can handle?

Excel can handle millions of rows, but performance slows significantly beyond 1 million rows. For very large datasets, consider using Power BI or a database system instead.