Groups | Blog | Home
all groups > sql server dts > march 2007 >

sql server dts : Newbie looking for advice on method of importing Excel workbook with group and detail records on first worksheet


kbutterly
3/16/2007 11:44:13 AM
Good afternoon, all,

I have an Excel workbook that needs to be imported. It has three
sheets, but it's really the first that is giving me fits. Each of the
three worksheets have header info and instructions on the first 8
rows. Worksheet 1 then has, on row 9, the column names for the group
informtion. Row 10 has the group information. Row 11 has detail
column headers. Row 12 and later have detail information. Worksheets
2 and three do not have detail information, just row 9 with the column
names for the group informtion and Row 10 with group information.

Here is how I am thinking of handling this.
Run a script, outside of SSIS to save each sheet as a CSV file to a
folder. I believe that this must be done because some of the first 8
rows are blank and according to the docs, SSIS cannot have blank rows
in imported Excel sheets.
Loop over the files in the folder.
For each file, exclude the first 8 rows.
if the file name is the first worksheet then
get the next two rows and process group info
get the rest of the worksheet and process detail information
if the file name is not the first worksheet then
get the next two rows and process group info


My questions are: Does this seem feasible? Is there an easier way to
do this? Any hints or tricks that might be helpful? Any pitfalls
that I should watch out for?

Thanks so much for any insights,
Kathryn
IanO
3/21/2007 11:38:51 AM
I have used this technique with other Microsoft tools but have not
tested it with SSIS.
Select the portion of the worksheet you want to import.
Use the Excel menu
Insert
\Name
\define


The name you define is global to the workbook.
In ssis, create an ADO.Net connection and point it to the
workbook.NameYouDefined.

I have used ADO with the named ranges in Excel many times.
I have not tried the same with ADO.Net.

It is worth a try.

Hope this helps.
Vassil Kovatchev
4/20/2007 9:18:31 AM
[quoted text, click to view]

Hi Kathryn,

You may find DataDefractor (http://www.datadefractor.com) useful. This
is a custom SSIS source component designed to consume (extract) data
from complex Excel worksheets. It provides a user interface to map-out
the schema of your worksheet, which is used by DataDefractor to
normalize the data and pump it into the SSIS pipeline - no coding is
required. You can download a free 14-day evaluation version at
http://www.datadefractor.com.

Best regards,
Vassil
AddThis Social Bookmark Button