How to Insert SQL Query in Microsoft Excel: 13 Steps

Table of contents:

How to Insert SQL Query in Microsoft Excel: 13 Steps
How to Insert SQL Query in Microsoft Excel: 13 Steps

Video: How to Insert SQL Query in Microsoft Excel: 13 Steps

Video: How to Insert SQL Query in Microsoft Excel: 13 Steps
Video: How To Split PDF Pages Into Separate Files 2024, November
Anonim

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

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

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

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

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

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

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

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

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

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

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

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

Step 12. Write the SQL query in the "Command Text" field, then click "OK"

Excel will display the query result data.

Recommended: