How to Embed a SQL Query in Microsoft Excel
Go to Data tab and select From Other Sources as shown in the screen shot below., Select “From Data Connection Wizard” in the drop down. , Data Connection Wizard will open., Connect to ODBC Data Source window appears., Select Database and Table...
Step-by-Step Guide
-
Step 1: Go to Data tab and select From Other Sources as shown in the screen shot below.
Select “ODBC DSN” from the available option and click “Next”. , Where a list of database available in our organization will be displayed.
Select the appropriate database and click on “Next”. ,, So, select the database and table as appropriate in our case. , This window will pull up the File Name based on our selection in previous screens. ,,, Click on Properties in the following window. ,,, -
Step 2: Select “From Data Connection Wizard” in the drop down.
-
Step 3: Data Connection Wizard will open.
-
Step 4: Connect to ODBC Data Source window appears.
-
Step 5: Select Database and Table window appears.
-
Step 6: We can select the database and the table from where we wish to pull the data.
-
Step 7: Select Finish in “Save Data Connection File and Finish” window.
-
Step 8: Import Data window appears where we can select options as per our need and click OK.
-
Step 9: Select “From Data Connection Wizard” in the drop down.
-
Step 10: Go to Data tab and Click on Connections.
-
Step 11: Go to Definitions tab in the following window.
-
Step 12: Write SQL query in “Command Text” and Click OK. Excel will display the result as per the query.
-
Step 13: Now go to Microsoft Excel and validate if the results are as per the SQL Query written.
Detailed Guide
Select “ODBC DSN” from the available option and click “Next”. , Where a list of database available in our organization will be displayed.
Select the appropriate database and click on “Next”. ,, So, select the database and table as appropriate in our case. , This window will pull up the File Name based on our selection in previous screens. ,,, Click on Properties in the following window. ,,,
About the Author
Carolyn Jordan
Creates helpful guides on crafts to inspire and educate readers.
Rate This Guide
How helpful was this guide? Click to rate: