SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Import Data from Multiple Excel Sheets using SSIS


Import Data from Multiple Excel Sheets using SSIS

Author
Message
purushoth.Chennai
purushoth.Chennai
SSC-Enthusiastic
SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)

Group: General Forum Members
Points: 189 Visits: 174
Hi friends,

Can anyone help me out how to extract data from multiple excel sheets (same excel doc having multiple sheets) using SSIS 2005

Thanks,
Purushoth
Ramesh Saive
Ramesh Saive
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3456 Visits: 2643
1. You need 1 Data Flow Task, containing an EXCEL source Connection and a SQL destination connection
2. Script Task to get list of sheets within the excel file
3. For Each ADO Loop Enumerator to loop through sheets

You also need to dynamically set source connection using variables/expressions. Currently, I don't have a working example/sample of it. May be you can look BOL for information on above.

--Ramesh


purushoth.Chennai
purushoth.Chennai
SSC-Enthusiastic
SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)

Group: General Forum Members
Points: 189 Visits: 174
Ramesh,

Thanku very much for ur help.. i ll try and get back to u if i get any doubt..

Happy Programming!!!
abader
abader
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 28
There is a reasonably useful article on TechNet that describes most of the work needed to import data from multiple worksheets in an Excel file with SSIS.

http://technet.microsoft.com/en-us/library/ms345182.aspx

However, the last step in this article leaves you with a number of assumptions. Once you have followed all the steps listed in the technet article, this is what you have to do.

1. Add a Data Flow task to the For Each loop container.
2. In the Data Flow container, add an Excel Source component.
3. Set the OLE DB connection manager to the Excel connection manager that you would've already setup.
4. Change Data access mode for the Excel Source component to 'Table name or view name variable'. This will allow you to use the variable name to specify the name of worksheet, instead of hard coding it.
Note: You may want to use a specific sheet within the Excel file first in order for SSIS to pickup the various column names. Once you are done with the column mapping, you can change this setting back to variable name.

Now you can continue on with whatever you want to do with the data that is read from each worksheet, one worksheet at a time.

Hope this helps.

-- Adnan
Pedro Perfeito
Pedro Perfeito
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 138
I made an example for those people that still need:
http://biresort.net/blogs/pedrocgd/archive/2009/08/06/stepbystep-ssis-extract-data-from-multiple-excel-worksheets.aspx

I hope this help.
regards,
Pedro
www.pedrocgd.blogspot.com
Maxer
Maxer
Say Hey Kid
Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)

Group: General Forum Members
Points: 666 Visits: 1603
Pedro Perfeito (8/6/2009)
I made an example for those people that still need:
http://biresort.net/blogs/pedrocgd/archive/2009/08/06/stepbystep-ssis-extract-data-from-multiple-excel-worksheets.aspx

I hope this help.
regards,
Pedro
www.pedrocgd.blogspot.com


That URL no longer seems to work, I don't suppose you still have that information posted somewhere else?
Pedro Perfeito
Pedro Perfeito
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 138
The site is temporarly down... I can send the paper I made to all those interesed on it.
Check my email in my BLOG profile and I imediatly send it to you while the site is down.
Regards,
Pedro
http://www.pedrocgd.blogspot.com
che.jennifer
che.jennifer
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 62
Hi there,

Thanks for posting the link http://technet.microsoft.com/en-us/library/ms345182.aspx.

However, you also wrote that we can add an Excel Source task in the Data Flow afterwards. And in the Excel Source, select the excel connection that we've already made.

I think it's incorrect. If we follow the link, the connection we create is an ADO.NET connection, not a OLE DB connection, which is what the Excel Source required.

Could you please correct that and advise what to do after the Foreach Loop is configured?

Thanks heaps.
sqlusers
sqlusers
Old Hand
Old Hand (307 reputation)Old Hand (307 reputation)Old Hand (307 reputation)Old Hand (307 reputation)Old Hand (307 reputation)Old Hand (307 reputation)Old Hand (307 reputation)Old Hand (307 reputation)

Group: General Forum Members
Points: 307 Visits: 512
Thanks abader. It help me to solve the problem.
amenjonathan
amenjonathan
SSC Veteran
SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)

Group: General Forum Members
Points: 246 Visits: 434
For anyone still working on this, I found out how to pass the table name gathered in the ADO NET enumerator to the Excel source in the data flow.

1. Inside the ADO NET enumerator, add a data flow task.
2. Inside the data flow task, add an Excel source.
3. Open the Excel source, and point to the Excel data source set up in the file enumerator.
4. Select one of the sheets that shows in the drop down.
5. Close the Excel source.
6. Select the Excel source.
7. In the properties window, copy the name of the sheet you selected. It's in the 'OpenRowset' property.
8. Set this as the intitial string in your sheet name variable created to gather the sheet name from the ADO NET enumerator.
9. Select the Excel source.
10. In the properties window, change the 'AccessMode' to OpenRowset From Variable. This will change the property 'OpenRowset' to 'OpenRowsetVariable'.
11. Change the 'OpenRowsetVariable' to the variable created to hold the sheet name via the dropdown.
12. Open the Excel source. You should see your variable as the sheet name.
13. Click the 'Columns' tab to verify you can connect and mess with columns.

-------------------------------------------------------------------------------------------------
My SQL Server Blog
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search