This article will guide users to insert SQL queries in Excel 2010 and create dynamic connections.
Step
![Embed a SQL Query in Microsoft Excel Step 1 Embed a SQL Query in Microsoft Excel Step 1](https://i.how-what-advice.com/images/007/image-20573-1-j.webp)
Step 1. Click the Data tab, then select From Other Sources as shown in the following screenshot
![Embed a SQL Query in Microsoft Excel Step 2 Embed a SQL Query in Microsoft Excel Step 2](https://i.how-what-advice.com/images/007/image-20573-2-j.webp)
Step 2. Select “From Data Connection Wizard” from the drop down menu
![Embed a SQL Query in Microsoft Excel Step 3 Embed a SQL Query in Microsoft Excel Step 3](https://i.how-what-advice.com/images/007/image-20573-3-j.webp)
Step 3. The Data Connection Wizard window will open
Select "ODBC DSN" from the available options, then click "Next".
![Embed a SQL Query in Microsoft Excel Step 4 Embed a SQL Query in Microsoft Excel Step 4](https://i.how-what-advice.com/images/007/image-20573-4-j.webp)
Step 4. The ODBC Data Sources window will open and display a list of databases available in the organization
Select the appropriate database, then click “Next”.
![Embed a SQL Query in Microsoft Excel Step 5 Embed a SQL Query in Microsoft Excel Step 5](https://i.how-what-advice.com/images/007/image-20573-5-j.webp)
Step 5. The Select Database and Table window will appear
![Embed a SQL Query in Microsoft Excel Step 6 Embed a SQL Query in Microsoft Excel Step 6](https://i.how-what-advice.com/images/007/image-20573-6-j.webp)
Step 6. You can now select the database and table containing the data you want to pull
Choose the appropriate database.
![Embed a SQL Query in Microsoft Excel Step 7 Embed a SQL Query in Microsoft Excel Step 7](https://i.how-what-advice.com/images/007/image-20573-7-j.webp)
Step 7. Click Finish on the “Save Data Connection File and Finish” window
The window will display the file name according to the data selected on the previous screen.
![Embed a SQL Query in Microsoft Excel Step 8 Embed a SQL Query in Microsoft Excel Step 8](https://i.how-what-advice.com/images/007/image-20573-8-j.webp)
Step 8. The Import Data window will appear
In this window, select the appropriate data, then click "OK".
![Embed a SQL Query in Microsoft Excel Step 9 Embed a SQL Query in Microsoft Excel Step 9](https://i.how-what-advice.com/images/007/image-20573-9-j.webp)
Step 9. Select “From Data Connection Wizard” from the drop down menu
![Embed a SQL Query in Microsoft Excel Step 10 Embed a SQL Query in Microsoft Excel Step 10](https://i.how-what-advice.com/images/007/image-20573-10-j.webp)
Step 10. Click the Data tab, then click Connections
In the next window, click Properties.
![Embed a SQL Query in Microsoft Excel Step 11 Embed a SQL Query in Microsoft Excel Step 11](https://i.how-what-advice.com/images/007/image-20573-11-j.webp)
Step 11. Open the Definitions tab in the next window
![Embed a SQL Query in Microsoft Excel Step 12 Embed a SQL Query in Microsoft Excel Step 12](https://i.how-what-advice.com/images/007/image-20573-12-j.webp)
Step 12. Write the SQL query in the "Command Text" field, then click "OK"
Excel will display the query result data.