slowsnow
slowsnow

Reputation: 23

Dynamic PowerQuery in Excel

I have a SQL query with WHERE clause, eg.:

SELECT Product_ID, Product_Name, Product_Quantity
FROM dbo. Products
WHERE Product_ID IN ('12AA35', '95LT20', '10RT36')

I am using Excel add in PowerQuery connecting to DB. The list of prducts is recieved in Excel and I have retrieve additional data from DB.

Q: is it possible (and how) to setup a query in PowerQuery that it could look at specified range, where products ID will placed. In other words, instead of placing IDs in SQL query, ID will located in Excel sheet. It will save me some time.

Thanks!

Upvotes: 1

Views: 339

Answers (1)

You can do the following:

  1. Select the table in Excel and click on From Table in the Power Query ribbon tab
  2. Click on Merge Queries in the Home tab in the Query Editor.
  3. Choose the database table as the other table, and choose Inner for the Join Kind.

Upvotes: 1

Related Questions