Join an Excel Table to SQL Server Data with Power Query
Question details
The user wants to join a small Excel worksheet table with a large SQL Server table using Power Query or Microsoft Query.

- Product
- Microsoft Excel Power Query and SQL Server
- Device & OS
- not provided
- Scenario
- Combine workbook keys with matching records from a larger server table, ideally performing the join on SQL Server.
- Observed behavior
- A SQL query cannot reference an ordinary workbook table by name as though it were a SQL Server table.
Confirm the join columns in Excel and SQL Server contain compatible values and data types. Check your SQL Server access and whether you have permission to create or load a staging table.
Load the Excel table into SQL Server for a server-side join
Use a staging table when the SQL Server table is large and you need the join to run on the server.
A workbook table is a separate data source, so it cannot be referenced by its workbook table name in an ordinary SQL Server query. Loading its rows into SQL Server makes both sides available for a server-side join.
In Excel, select the range and choose Insert > Table. Give the columns clear names, check the join key, and save the workbook.
In SQL Server Management Studio, right-click the destination database and choose Tasks > Import Data. In the import wizard, select Microsoft Excel as the source and SQL Server as the destination, then map the worksheet columns to a staging table.
Open New Query in SQL Server Management Studio and join the staging table to the server table on the matching key. To keep every Excel row, use the staging table on the left side of a LEFT JOIN.
In Excel, choose Data > Get Data > From Database > From SQL Server Database. Connect to the database and select the result through a view or a suitable SQL query.

Merge the Excel and SQL Server queries in Power Query
Use a Power Query merge when you cannot load the workbook data into SQL Server and the amount of retrieved data is manageable.
Work with Excel tables in WPS Office
WPS Office is a free, lightweight alternative for working with spreadsheets in a familiar interface. Its Microsoft Excel format compatibility helps you move existing workbooks into WPS, although it does not fix Microsoft Power Query or perform the SQL Server join described above.

Frequently Asked Questions
Can SQL Server reference my Excel table by its workbook name?
Not in an ordinary SQL Server query: the workbook is a separate data source. You can load its rows into a staging table, or use Power Query to merge the two sources. SQL Server can access external files through separately configured mechanisms, but those are not the same as directly referencing a workbook table in Power Query.
How do I keep every Excel row in the merged result?
In Power Query Editor, select the Excel query first, choose Home > Merge Queries, and select Left Outer as the join kind. In SQL, put the Excel staging table on the left of a LEFT JOIN.
Will a Power Query merge always run on SQL Server?
No. A merge between an Excel table and SQL Server may be evaluated locally. Filters and other steps may fold depending on the connector and query, so check folding and test the refresh.
Could filtering SQL Server with Excel values be faster than a merge?
It may be worth testing a filter based on the workbook keys. Some IN-style filters may fold to SQL Server, but folding is not guaranteed and performance depends on the query and dataset.
What if the Excel and SQL join columns have different data types?
In Power Query Editor, select each key column and use the Data Type control to assign compatible types. For a SQL staging-table join, also check the destination column types and ensure the values are formatted consistently.




