You can CREATE VIEW
and utilize that view in Excel 2016
under its data connections through PowerQuery
. Views are preferred since they are managed independently in the server, and provide realtime data results without requiring a full query to be embedded in the Excel file. The resulting set exists in the workbook as a refresh-able table. Results that need to be recorded should be done via new workbooks or UPDATE
's back to the server in a separate script.

In the PowerQuery Editor, Home tab, click Advanced Editor
. The database connection string and call to the server is below. You can also dynamically pass parameters from an Excel table to the query utilizing a table in the Name Manager
.
Excel tab, table name: tbl_Parameters
A B
1 StartDate 01/01/2020
2 EndDate 02/01/2020
let
Source = Sql.Database("ServerName" , "Database", [Query="
DECLARE @Start_Date AS datetime
DECLARE @End_Date AS datetime
SET @Start_Date = '"&StartDate&"'
SET @End_Date = '"&EndDate&"'
SELECT * FROM uvw_product
WHERE item_sold_date BETWEEN
@Start_Date AND @End_Date
"])
in
Source