Using Excel Column in SQL queries through Power Query

GBilianis

New Member
Joined
Jul 10, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello. I am not sure if this is the right group for this question. Anyway, I was wondering if it's possible to run SQL query, using a column from an excel as parameter, on an excel file. for example: Select * from (excel column) a inner join (Sql.table.column) b on a.column1 =b.column2. I want to run this using excel power query, if possible.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Yes there is a way. You can't directly do it within the "Insert SQL Statement", but after you load the SQL statement, you will notice that it posts the SQL code in the formula bar. All you have to do is close the quotation, and then put " & Query1 & " like the screenshot posted.

1689012686528.png
 
Upvote 0
Thanks a lot for your reply. I will try it tomorrow, since it's a work thing. I would like to know if it has to be in the same sheet that you run the query, or you can use another sheet's values
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top