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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,223,884
Messages
6,175,173
Members
452,615
Latest member
bogeys2birdies

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