SSIS – Let the Excel connection manager pick the right column data types from an Excel source

The excel connection manager scans every first 8 rows to determine the data type for a column in your SSIS source component. So if an Excel sheet column has integers on the first 8 rows and a string value on the 9th row, your data flow task will crash when executed because SSIS expects integers.

Fortunately you can change the number of rows that Excel will scan with the TypeGuessRows registry property.

Change TypeGuessRows:

1. Start Registry Editor by typing “regedit” in the run bar of the Start menu.

2. Search the register (CTRL-F) on “TypeGuessRows”.
Search

3. Double click “TypeGuessRows” and edit the value.
Edit

Todd McDermid (MVP) commented the following useful addition:
“Unfortunately, that reg key only allows values from 1 to 16 – yes, you can only increase the number of rows Excel will “sample” to 16.”

Robbert Visscher commented:
“The reg key also allows the value 0. When this value is set, the excel connection manager scans every row to determine the data type for a column in your SSIS source component.”

Thanks Robbert, I think setting it to 0 can be very powerful in some scenario’s!
 
So the conclusion of the comments of Todd and Robbert is that a value from 0 to 16 is possible:
  • TypeGuessRows 0: All rows will be scanned. This might hurt performance, so only use it when necessary.
  • TypeGuessRows 1-16: A value between 1 and 16 is the default range for this reg key, use this in normal scenario’s.