Connect to (import) SQL Server data

You can use an Office Data Connection (.odc) file to connect to a Microsoft SQL Server database from a Microsoft Excel file. SQL Server is a full-featured, relational database program that is designed for enterprise-wide data solutions that require optimum performance, availability, scalability, and security.

  1. On the Data tab, in the Get External Data group, click From Other Sources, and then click From SQL Server.

Excel Ribbon Image

This starts the Data Connection Wizard. This wizard has three pages.

Page 1: Connect to Database Server    

  1. In the Server name box, type the name of the SQL Server computer that you want to connect to.
  2. Under Log on credentials, do one of the following:
    • To use your current Microsoft Windows user name and password, click Use Windows Authentication.
    • To enter a database user name and password, click Use the following User Name and Password, and then type your user name and password in the corresponding User Name and Password boxes.

Security   Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. For more information, see Help protect your personal information with strong passwords.It is critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.

Page 2: Select Database and Table    

  1. Under Select the database that contains the data you want, select a database. Under Connect to a specific table, select a specific table or view.

Alternatively, you can clear the Connect to a specific table check box so that other users who use this connection file will be prompted for the list of tables and views.

Page 3: Save Data Connection File and Finish    

  1. Optionally, in the File Name box, revise the suggested file name. Click Browse to change the default file location (My Data Sources).
  2. Optionally, type a description of the file, a friendly name, and common search words in the Description, Friendly Name, and Search Keywords boxes.
  3. To ensure that the connection file is always used when the data is updated, click the Always attempt to use this file to refresh this data check box. This option ensures that updates to the connection file will always be used by all workbooks that use that connection file.
  4. To specify how the external data source of a PivotTable report is accessed if the workbook is published to a Microsoft SharePoint Services site and is opened in a Web browser, click Authentication Settings, and then select one of the following options to log on to the data source:
    • Windows Authentication    Select this option to use the Windows user name and password of the current user. This is the most secure method, but it can affect performance when many users are connected to the server.
    • SSS    Select this option to use Secure Storage Service (SSS), and then enter the appropriate identification string in the SSS ID box. A site administrator can configure a SharePoint Services site to use a Secure Storage Service database in which a user name and password can be stored. This method can be the most efficient when many users are connected to the server.
    • None    Select this option to save the user name and password in the connection file.

Security  Avoid saving logon information when connecting to data sources. This information may be stored as plain text, and a malicious user could access the information to compromise the security of the data source.

  1.  Note   The authentication setting is used only when you publish a workbook to a SharePoint site, and not by the Excel desktop program.

  2. Click OK, and then click Finish to close the Data Connection Wizard.

The Import Data dialog box appears.

  1. Under Select how you want to view this data in your workbook, do one of the following:
    • To create an Excel table, click Table (this is the default).
    • To create a PivotTable report, click PivotTable Report.
    • To create a PivotChart and PivotTable report, click PivotChart and PivotTable Report.

 Note   The Only Create Connection option is available only for an OLAP database.

  1. Under Where do you want to put the data?, do one of the following:
    • To place the data in an existing worksheet, select Existing worksheet, and then type the name of the first cell in the range of cells where you want to locate the data.
    • Alternatively, click Collapse Dialog Button image to temporarily collapse the dialog box, select the beginning cell on the worksheet, and then click Expand Dialog Button image.
    • To place the data in a new worksheet starting at cell A1, click New worksheet.
  2. Optionally, you can change the connection properties (and also change the connection file) by clicking Properties, making your changes in the Connection Properties dialog box, and then clicking OK.

For more information, see Connection properties.

Top of Page Top of Page

 
 
Applies to:
Excel 2010