To add a table to a new query in Excel, select your data range, go to the Data tab, and select From Table/Range. This process imports your spreadsheet data into the Power Query Editor, allowing you to clean, transform, and reshape the data without affecting the original source. Power Query creates a connection to the table, meaning any changes made to the source data can be refreshed in the query with a single click.

What You'll Need

  • Microsoft Excel (Power Query is built-in for versions 2016 and later; for 2010 or 2013, the Power Query add-in must be installed).
  • A dataset organized in rows and columns.
  • Headers for each column to ensure the query can identify data types correctly.

Step-by-Step

  1. Format Your Data as a Table: Before creating a query, your data must be an official Excel Table. Select any cell within your data range. Go to the Insert tab and click Table, or press Ctrl + T. In the Create Table dialog box, ensure the box "My table has headers" is checked if your data includes column names. Click OK. (Note: Menu labels may vary slightly depending on your version of Excel or region).
  2. Name Your Table: To keep your queries organized, give your table a descriptive name. While the table is selected, go to the Table Design tab. On the far left, locate the Table Name box and replace "Table1" with a specific name, such as "SalesData2023". Press Enter.
  3. Launch the Query Process: Click any cell inside your newly named table. Navigate to the Data tab on the top ribbon. In the "Get & Transform Data" group, click the button labeled From Table/Range.
  4. Enter the Power Query Editor: After clicking From Table/Range, Excel will automatically open the Power Query Editor window. This is a separate interface from the main Excel spreadsheet. You will see a preview of your data here.
  5. Verify Data Types: Look at the icons next to the column headers (e.g., 1.2 for decimals, ABC for text). If Excel has misidentified a column—for example, treating a date as text—click the icon and select the correct data type from the dropdown menu. This ensures calculations and filters work correctly later.
  6. Perform Transformations: Use the ribbon in the Power Query Editor to modify your data. You can remove unnecessary columns by right-clicking a header and selecting Remove, filter out blank rows using the dropdown arrow on a column header, or split a single column (like "First Name Last Name") into two using the Split Column feature.
  7. Load the Data Back to Excel: Once the data is cleaned, go to the Home tab in the Power Query Editor. Click the arrow under Close & Load. You have two primary options: "Close & Load" (which creates a new worksheet with the transformed table) or "Close & Load To..." (which allows you to choose if the data goes to an existing sheet, a PivotTable report, or only creates a connection).
  8. Set Up Refresh Settings: To ensure your query updates when the source table changes, right-click the resulting query table in your worksheet, select Table > External Data Properties, and check the box for "Refresh data when opening the file" or set a specific time interval.

Common Mistakes

One of the most frequent errors is failing to format the data as a Table (Ctrl + T) before attempting to create the query. If you simply select a range of cells and click From Table/Range, Excel will force you to create a table first, which can be confusing if you aren't expecting the prompt. Another common mistake is neglecting to name the table. When working with multiple queries, having a list of "Table1", "Table2", and "Table3" makes it nearly impossible to remember which query connects to which data source.

Users also often forget that Power Query is case-sensitive. If you create a custom column or a filter based on text, "Sales" and "sales" are treated as different values. This can lead to missing data in your final output if the source data is inconsistent. Finally, many users perform transformations in the main Excel sheet and then try to import them into a query, rather than performing the transformations inside the Power Query Editor. The power of the tool lies in its ability to record these steps and repeat them automatically during a refresh.

Tips

To maximize efficiency, use the "Applied Steps" pane on the right side of the Power Query Editor. Every action you take—filtering a row, changing a type, or renaming a column—is recorded as a step. If you make a mistake, you don't need to start over; simply click the "X" next to the specific step to undo it. This provides a non-destructive way to experiment with your data.

For larger datasets, consider using "Close & Load To..." and selecting "Only Create Connection". This prevents Excel from duplicating the data on a new sheet, which saves memory and keeps the file size smaller. You can then use this connection as a source for a PivotTable, which summarizes the data without needing to display thousands of rows of raw information. Additionally, always check for trailing spaces in your text columns. Using the Transform > Format > Trim feature in Power Query removes invisible spaces at the start or end of cells, which prevents errors during VLOOKUPs or merging queries.

Troubleshooting

If the "From Table/Range" button is greyed out, ensure that you have actually selected a cell inside a formatted Table. If the data is just a range of cells, the button may not activate correctly in some versions. If you receive an error stating "The column [Column Name] of the table wasn't found," it usually means you renamed a column in the original Excel sheet after the query was already created. To fix this, open the Power Query Editor, go to the Applied Steps pane, and find the step where the error occurs. Either rename the column back to the original name in the spreadsheet or update the step in the editor to match the new name.

If the data does not update after you change the source table, check the refresh settings. Right-click the output table and select Refresh. If it still doesn't update, ensure that the source table range hasn't been accidentally broken (e.g., by inserting a completely blank row or column that separates the data from the table boundaries). If the Power Query Editor fails to launch, restart Excel and check if there are any pending updates for your Office installation, as version mismatches can occasionally cause the add-in to crash.

Frequently Asked Questions

Can I add multiple tables to a single query?

Yes, you can. After adding your first table, you can use the "Merge Queries" or "Append Queries" features in the Power Query Editor to combine data from other tables based on a matching column or by stacking them on top of each other.

Do I have to recreate the query if I add new rows to my table?

No. Because you used a formatted Table, any new rows added to the bottom of that table are automatically included in the query range. You simply need to click "Refresh" to pull the new data into the query output.

What is the difference between "Merge" and "Append"?

Merging is like a JOIN in SQL or a VLOOKUP; it adds columns from one table to another based on a common key. Appending is like copying and pasting one table below another; it adds rows from one table to another, provided they have the same column headers.

Can I connect to a table in a different Excel file?

Yes. Instead of selecting From Table/Range, go to Data > Get Data > From File > From Excel Workbook. This allows you to pull a table from an external file without having to open that file first.

Does Power Query change my original data?

No. Power Query is read-only regarding the source. It takes a snapshot of your data, applies the transformations you specify, and outputs the result to a new location. Your original source table remains untouched.