2
votes

Please note I have found solutions to this in Excel 2007, 2010, 2013 etc but nothing that relates directly to 2016.

I bring in a query to Excel by using Data / Get Data / From Database / From SQL Server Database.

What I want to do is restrict 1 column in the data it retrieves to a specific value.

In my exact example there is a date column and I want a cell in the spreadsheet to pass the date value to filter the returned query data.

1

1 Answers

0
votes

For this application, I don't think you need to actually pass the date as a parameter to your query. You can just use the date from the cell as a filter after you've loaded your query into the Query Editor. As a result of query folding, Excel should automatically pass it into the WHERE clause of the native query it sends to the SQL Server Database.

If you don't know how to reference a cell value in the Query Editor, please see this question:

How can I reference a cell's value in a Power Query