Question: how to export data from sql server 2017 to excel using query?
Answer: This will open the SQL Server Import and Export Wizard window:
To proceed with exporting SQL Server data to an Excel file, click the Next button. ... 
From the Data source drop down box, choose the SQL Server Native Client 11.0 item.