Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Export to Excel existing worksheet

Author  Topic 

vishal_7
Posting Yak Master

127 Posts

Posted - 2006-10-16 : 11:37:04
Hello,

I know how to export a table to excel, however I do not know how to export the data to my worksheet which is pretty much a template. In my worksheet I formatted the columns/rows and just need to insert the data via SQL. Can someone point me to a resource? I am already googleing and searching the forums.

Thanks

vishal_7
Posting Yak Master

127 Posts

Posted - 2006-10-16 : 12:24:00
I know the DTS Wizard, however it does not let me remove the rows from excel. Basically my excel sheet contains several clumns, which are calculated based on the data placed inside the excel. Its basically a template which needs to be filled everytime. The DTS Export wizard appends the rows to my excel. Any ideas?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-10-17 : 08:35:40
http://weblogs.sqlteam.com/mladenp/archive/2006/07/25/10771.aspx
or
the most viewed thread here:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

ws5926
Yak Posting Veteran

88 Posts

Posted - 2006-10-18 : 12:53:22
I have a very similar proces in production right now. It also emails the results when finished. It's kind of a hack in my opinion, but works very well so far.

Instead of clearing the rows out before putting the new ones in, have a copy of the excel file with no rows in it. Then just cmdshell and copy that template to a new file and then use DTS to put the new rows in. The Excel DTS export adds the rows to the end of the file.

I have a trick to get the Active X commands easily to format the excel file afterwards. I can also post the code to email the results if needed. You will need to have Excel installed on the server.

Live to Throw
Throw to Live
Go to Top of Page
   

- Advertisement -