Connecting to SQL Server from Microsoft Excel using ODBC Driver for SQL Server

You can use Microsoft Excel to access data from a SQL Server database using ODBC connector. With ODBC Driver, you can import the data directly into an Excel Spreadsheet and present it as a table. Make sure that you use matching Excel and ODBC Driver, e.g. if you have installed a 64-bit ODBC Drive, you will need to use the 64-bit version of Excel.

When working with Microsoft Excel, there are different ways of retrieving data from various data sources using our ODBC drivers:

  • Connecting Excel to SQL Server with Get & Transform (Power Query)
  • Connecting Excel to SQL Server with Data Connection Wizard (Legacy Wizard)
  • Connecting Excel to SQL Server with the Query Wizard
  • Connecting Excel to SQL Server with Microsoft Query
  • Connecting Excel to SQL Server with PowerPivot

  • Please see more information on connecting Excel to various data sources below.

    Recommended hardware drives, hardware sizing, and disc space

    Connecting to SQL Server from Microsoft Excel using ODBC Driver for SQL Server

    You can use Get & Transform (Power Query) to connect to SQL Server from Excel with ODBC. This method assumes that you've installed an ODBC driver for SQL Server.

    1. Click the Data in Excel, then expand the Get Data drop-down list. Click From Other Sources > From ODBC.
    2. Connect Excel to ODBC data source

    3. In the From ODBC dialog, choose your data source name (DSN). If you haven't configured your ODBC driver yet, you can expand the Advanced Options dialog box and enter the connection string for your data source (without credentials, which are defined in the credentials dialog box in the next step). Additionally, you can enter an SQL statement that will be executed right after establishing a connection to the data source. Click OK.
    4. Choose ODBC data source in Excel

    5. If you're using a database username or password, select Database and enter your credentials in the dialox bog, then click Connect.
    6. Enter Data Source Credentials

      If your database is not password-protected or you've already specified your credentials in the ODBC data source settings, select Default or Custom and press Connect

      Excel ODBC custom connection string

    7. In the window that appears, select the table you want to retrieve data from, and click Load.
    8. List of tables from ODBC data source

      The data from the table will be a displayed in an Excel spreadsheet where you can further work with it.

      View the table contents

    Connecting Excel to SQL Server with Data Connection Wizard (Legacy Wizard)

    You can use this option to connect to OLE DB or ODBC external data source that has already been defined.

    1. In Excel, go to the Data tab. Click From Other Sources, and then click From Data Connection Wizard.
    2. In the opened dialog, select ODBC DSN and click Next to continue.

    3. Now select a data source you want to connect to, and click Next.

    4. To connect to the table containing the required data, select its name and click Next to enter and save information about your new file or click Finish.

    5. In the Import data dialog, you can select the way your data will be viewed in Excel and the place where to put it in the worksheet, and click OK.

    6. The required data is now displayed in the existing Excel worksheet.

    Connecting Excel to SQL Server with the Query Wizard

    You can use this option to create a simple query for retrieving data from SQL Server to Excel via ODBC driver.

    1. Open Excel, in the main menu, click the Data tab.
    2. Click the From Other Sources dropdown menu, and then click From Microsoft Query.

    3. In the appeared dialog, you can choose the data source you want to connect to.

    4. After a successful connection, you can select the data you want to be displayed in Excel and click Next.

    5. The next two steps allow filtering and sorting the data. Click Next to skip these procedures.

    6. If you plan to further use the query, you can save it by clicking the Save button on the right.

    7. Select Return Data To Microsoft Excel and click Finish.

    8. In the Import data dialog, you can select the way your data will be viewed in Excel and the place where to put it in the worksheet, and click OK.

    9. The required data is successfully imported to Excel.

    Connecting Excel to SQL Server with Microsoft Query

    You can use this option to create a more complex query for retrieving SQL Server data to Excel via ODBC driver.

    1. Start Excel, click the Data tab.
    2. In the appeared ribbon, click From Other Sources, and then click From Microsoft Query.

    3. In the next dialog, choose the data source you want to connect to (e.g., using data source name - Devart ODBC SQL Server). Uncheck Use the Query Wizard to Create/Edit Queries and click OK.

    4. Now you can select the tables you want to add to your query. When you finish, just click the Add button.

    5. In the graphical editor, you can filter rows or columns of data, sort data, join multiple tables, create a parameter query, etc.

    Connecting Excel to SQL Server with PowerPivot

    You can use PowerPivot - an Excel add-in to perform data analysis and create complex data models. To load the required data, do the following:

    1. In Excel, click the PowerPivot tab, then click Manage to go to the PowerPivot window.
    2. In the opened window, click From Other Sources.

    3. When the Table Import Wizard opens, select Others (OLEDB/ODBC) and click Next.

    4. In the Specify a Connection String window, click the Build button.

    5. In the Data Link Properties dialog, specify the data source you want to connect (e.g., using data source name - Devart ODBC SQL Server), and then click Next.

    6. Now you should choose how to import the data (either select a table from the list or write a query to specify the data to be imported).

    7. When the Import operation succeeded, click the Close button. The retrieved data is inserted in the active worksheet.

    Frequently Asked Questions

    How to connect Excel to SQL Server?

    You can connect to your SQL Server databases from Microsoft Excel using a dedicated ODBC connector. Various methods are available for importing data, including Get & Transform (Power Query), the Data Connection Wizard (Legacy Wizard), the Query Wizard, Microsoft Query, and PowerPivot.

    The simplest method is using Get & Transform (Power Query), assuming you have already installed the necessary ODBC driver to connect SQL Server to Excel.

    For more information about the different ways of connecting to SQL Server from Microsoft Excel using the Devart ODBC driver and the usage of this connector, refer to the documentation.

    What is ODBC for SQL Server?

    The Devart ODBC Driver for SQL Server is a high-performance connectivity solution with robust features designed for accessing SQL Server databases from any ODBC-compliant BI, ETL, reporting, or analytics tools. It fully supports all standard ODBC API functions and data types. Also, it is compatible with Windows (32-bit and 64-bit versions), macOS, and Linux.

    With this driver, users can easily and securely access live SQL Server data from any location, without needing to install additional clients or libraries. It offers an efficient solution for data and application development, management, and analysis.

    How to get SQL Server data in Excel?

    When working with Microsoft Excel, you can apply different methods to retrieve data from SQL Server databases using our ODBC drivers.

    After installing the driver, open your Excel sheet, navigate to the Data tab, and select Get External Data > From Other Sources. From there, choose the appropriate option. You can import data using various methods, including Get & Transform (Power Query), the Data Connection Wizard (Legacy Wizard), the Query Wizard, Microsoft Query, or PowerPivot.

    Another option is using the Devart Excel Add-in for SQL Server as it is specifically designed to import data from SQL Server databases directly into Excel. It allows in-Excel editing and provides the ability to load the edited data back into the database.

    ODBC Drivers

    Reliable and simple to use data connectors for ODBC data sources. Compatible with multiple third-party tools.