Wednesday, February 15, 2012

DTS to Create New Excel Sheet in Existing Workbook

Has anyone been able to create a DTS that will create a new sheet within an existing Excel file. I want one Excel file with multiple tabs referencing the beginning of each week and growing. The name needs to be dynamic so as to not overwrite previous sheets (tabs) in the file.

I have a current ActiveX script that will move the data to a dynamic name (date), I just can't create the table (sheet/tab) to move the data to.

Any help would be appreciated.

-MarkI don't think that you can...you probably need to use COM objects...

Why do you need multiple sheets?|||I have a user asking for statistics in Excel with weekly tabs to compare. I may just build something in Crytal.

Thanks,|||This may help

http://www.dbforums.com/t977745.html|||Multiple worksheets are done by creating multiple tables in your DTS package. Each table represents a worksheet.

There you have it :)|||To delete the sheet in your excel and re-create it
you can do it in SQL task by including the following lines:

DROP table `a43`
GO

CREATE TABLE `a43` (
`Col001` VarChar (2) ,
`Col002` VarChar (8) ,
...
...
... )

where a43 is your sheet name ~
hope this will help you out :D|||As has been previously stated, create a connection to your workbook, then use an execute sql task on the connection. The sql task should be a create table statement. This will create your sheets in your work book.

No comments:

Post a Comment