-1

There are xlsxb files and each of these consists of varying number of sheets (consists of upto 9 sheets) .All the sheets are of different structure.The requirement is to laoad a specific named sheet data into corresponding table.The specific named sheet may or may not appear in all the xlsb files.

Example:

1st xlsb file consists of  9 sheets(
sh1,sh2,...,sh9)

2nd xlsb file consists of 6 sheets(sh1,sh5,sh6,sh7,sh9,sh2)
3rd  xlsb file consists of 3 sheets(sh5,sh7,sh9)


The idea is all sh9 to be colleted in on table called Table_sh9.All sh5 has to 
be in Table_sh5

What SSIS design pattern can be followed for this.
user1254579
  • 3,901
  • 21
  • 65
  • 104

1 Answers1

1

To have this dynamic I recommend you do this with a script task. You can look into OpenXML and ClosedXML to read the data.

https://closedxml.codeplex.com/

I would read the header to determine what table you are loading to, then create a datareader from the input and feed that datareader to sqlbulkcopy.

I have a similar solution that automatically create the tables for me and I use the datastreams library -> https://www.csvreader.com/

Joe C
  • 3,925
  • 2
  • 11
  • 31
  • Thanks for the answer.The thing is as some of the xlsb files does not have some of the mentioned sheet names .package fails ,shows the error "opening a row set for "sheet6" failed" – user1254579 Jul 20 '16 at 09:11