Use Excel Cell Reference (Parameterize) in Sql Query to Local Sql Server

Use Excel Cell Reference (Parameterize) in Sql Query to Local Sql Server

I want to use 2 columns in excel (A & B) as parameters in an SQL query to an SQL Server. I then want to drag the query down 200 lines to select the required data from the DB.

Pic with Example

I have tried

Get Data > From Microsoft Query - Didn't work. It just doesn't seem to be the right avenue for this (ie: No option for this).

Get Data > From SQL Server Database and it brings up Navigator and I see a preview of the data. I don't want to import all the data though. I want to customize a query and only import that data.

This is not a duplicate of How do I write a query in Microsoft SQL Server Management Studio and then use that Query in Excel since those steps don't work in Excel 2016.

2
Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.