May 13, 2009 at 7:34 pm
With SSIS, is it possible to copy one sheet into other, new, sheets (tabs)?
I'm dynamically creating the individual sheets. I would like to copy an existing sheet, including the formatting.
How can this be done?
Thanks,
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
May 13, 2009 at 10:15 pm
Your signature contains a link to posting best practices, yet your post does not follow them!
Are you referring to Excel when you talk about 'sheets'?
Is any data involved, or are you just interested in copying meta data? Ie, do you just want a chunk of code that will copy an existing sheet to another sheet, given a source file name?
May 14, 2009 at 8:13 am
Phil Parkin (5/13/2009)
Your signature contains a link to posting best practices, yet your post does not follow them!Are you referring to Excel when you talk about 'sheets'?
Is any data involved, or are you just interested in copying meta data? Ie, do you just want a chunk of code that will copy an existing sheet to another sheet, given a source file name?
After reading my original post, I have to agree with you.
Yes, I'm working with Excel.
I have a "master" spreadsheet that has two sheets set up. When the SSIS package runs, it copies the file to it's destination location, then pushes data into it. The second sheet needs to be duplicated for each additional sheet that I need to create. The sheet does not contain any data, but it does contain formatting and formulas. After the sheet has been copied, I will be exporting data from sql into the new sheet via SSIS.
So, back to my question. From SSIS, can I copy an existing Excel sheet into a new sheet?
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
May 14, 2009 at 5:52 pm
This isn't easy.
The way I was thinking of doing this was to use a Script Task and use Excel.Application etc etc - but that relies on a reference to Microsoft.Office.Interop.Excel, which is a COM object. But COM objects are not available in the Script Task reference list.
So, to do this, you would need to wrap the COM object in a .NET interop class, create a DLL and add it to the GAC - after signing with a strong name key.
You would also need to install Excel on your server to do this. Maybe it's a path you do not want to go down ...
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply