How do we connect a Microsoft Excel to SQL Server

- How to create users in databases that belong to a SQL Server Always On Availability Group - 10 February 2025
- How to create a Logon Trigger to control which users are allowed to connect to an Oracle Database - 13 January 2025
- How do we collect the actual execution plan from queries using Extended Event and how do we read its data - 2 December 2024
The Excel of Microsoft although we use it every day and it is one of the most well-known and oldest Microsoft programs, it hides many possibilities.
In this article we will see how to connect a base of it SQL Server with Excel without ODBC and without even having to enter a code since this particular method allows us to save it inside the document.
First, open Excel and go to Data – From Other Sources – From SQL Server

Fill in the server name and the user.

We select the table we want although we can write a query afterwards and change it.

Select Save password in file and Finish.

Ready! He brought us the board entries. The Refresh All option reloads the data.

We choose under Refresh All – Connection Properties…

By selecting Save password, the password to access the database can be saved in Excel.
Of course we do not forget for security reasons to create users with minimum rights exclusively for this use.
By selecting Command Type in SQL we can write SQL in the Command text field.

We see the data we requested with the SQL query was returned.

Very interesting and useful post.