Jaa


Excel Destination

The Excel destination loads data into worksheets or ranges in Microsoft Excel workbooks.

Note

On a 64-bit computer, you must run packages that connect to Microsoft Excel data sources in 32-bit mode. The Microsoft Jet OLE DB Provider that connects to Excel data sources is available only in a 32-bit version.

Note

To load data to a data source that uses Microsoft Office Excel 2007, use an OLE DB destination. You cannot use an Excel destination to connect to an Excel 2007 data source. For more information, see Excel Connection Manager.

The Excel destination provides three different data access modes for loading data:

  • A table or view.
  • A table or view specified in a variable.
  • The results of an SQL statement. The query can be a parameterized query.

Important

In Excel, a worksheet or range is the equivalent of a table or view. The lists of available tables in the Excel Source and Destination editors display only existing worksheets (identified by the $ sign appended to the worksheet name, such as Sheet1$) and named ranges (identified by the absence of the $ sign, such as MyRange).

The Excel destination uses an Excel connection manager to connect to a data source, and the connection manager specifies the workbook file to use. For more information, see Excel Connection Manager.

The Excel destination has one regular input and one error output.

Usage Considerations

The Excel Connection Manager uses the Microsoft OLE DB Provider for Jet 4.0 and its supporting Excel ISAM (Indexed Sequential Access Method) driver to connect and read and write data to Excel data sources.

Many existing Microsoft Knowledge Base articles document the behavior of this provider and driver, and although these articles are not specific to Integration Services or its predecessor Data Transformation Services, you may want to know about certain behaviors that can lead to unexpected results. For general information on the use and behavior of the Excel driver, see HOWTO: Use ADO with Excel Data from Visual Basic or VBA.

The following behaviors of the Jet provider that is included with the Excel driver can lead to unexpected results when saving data to an Excel destination.

  • Saving text data. When the Excel driver saves text data values to an Excel destination, the driver precedes the text in each cell with the single quote character (') to ensure that the saved values will be interpreted as text values. If you have or develop other applications that read or process the saved data, you may need to include special handling for the single quote character that precedes each text value.
  • Saving memo (ntext) data. To successfully save strings longer than 255 characters to an Excel column, the driver must recognize the data type of the destination column as memo and not string. If the destination table already contains data, the first few rows that the driver samples must contain at least one value in the memo column that is longer than 255 characters. If the package creates the destination table during package design or at run time, the CREATE TABLE statement must use LONGTEXT, or one of its synonyms, as the data type for the memo column.
  • Data types. The Excel driver recognizes only a limited set of data types. For example, all numeric columns are interpreted as doubles (DT_R8), and all string columns (other than memo columns) are interpreted as 255-character Unicode strings (DT_WSTR). Integration Services maps the Excel data types as follows:
    • Numeric    double-precision float (DT_R8)
    • Currency     currency (DT_CY)
    • Boolean     Boolean (DT_BOOL)
    • Date/time     date (DT_DATE)
    • String     Unicode string, length 255 (DT_WSTR)
    • Memo     Unicode text stream (DT_NTEXT)
  • Data type and length conversions. Integration Services does not implicitly convert data types. As a result, you may need to use the Derived Column or Data Conversion transformations to convert Excel data explicitly before loading it into a non-Excel destination, or to convert non-Excel data before loading it into an Excel destination. In this case, it may be useful to create the initial package by using the Import and Export Wizard, which configures the necessary conversions for you. Some examples of the conversions that may be required include the following:
    • Conversion between Unicode Excel string columns and non-Unicode string columns with specific codepages.
    • Conversion between 255-character Excel string columns and string columns of different lengths.
    • Conversion between double-precision Excel numeric columns and numeric columns of other types.

Configuring the Excel Destination

You can set properties through SSIS Designer or programmatically.

For more information about the properties that you can set in the Excel Destination Editor dialog box, click one of the following topics:

The Advanced Editor dialog box reflects all the properties that can be set programmatically. For more information about the properties that you can set in the Advanced Editor dialog box or programmatically, click one of the following topics:

For more information about how to set properties, click one of the following topics:

For information about looping through a group of Excel files, see How to: Loop through Excel Files and Tables.

See Also

Tasks

How to: Loop through Excel Files and Tables

Concepts

Excel Source
Integration Services Variables
Creating Package Data Flow
Integration Services Considerations on 64-bit Computers

Other Resources

Integration Services Destinations
Working with Excel Files with the Script Task

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

15 September 2007

New content:
  • Added a note about how to use a 64-bit computer to run packages that connect to Excel data sources.
  • Described the results of saving memo data.

12 December 2006

New content:
  • Added a note about the use of Excel 2007 data sources.

14 April 2006

New content:
  • Added links to new topics on working with Excel.

5 December 2005

Changed content:
  • Expanded and rewrote entire Usage Considerations section to clarify known issues.