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


need to create an excel sheet without any data in it


need to create an excel sheet without any data in it

Author
Message
manibad
manibad
SSC Veteran
SSC Veteran (249 reputation)SSC Veteran (249 reputation)SSC Veteran (249 reputation)SSC Veteran (249 reputation)SSC Veteran (249 reputation)SSC Veteran (249 reputation)SSC Veteran (249 reputation)SSC Veteran (249 reputation)

Group: General Forum Members
Points: 249 Visits: 143
Hi,
I need to create an empty excel sheet using T-SQL.
Can any one help me out in this?

Thanks in advance
Igor Micev
Igor Micev
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10090 Visits: 5155
1) You can take a look at this link https://www.simple-talk.com/sql/t-sql-programming/sql-server-excel-workbench/
2) You can create it via SSIS package and execute the package from ssms.

Igor Micev,
My blog: www.igormicev.com
CKX
CKX
Mr or Mrs. 500
Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)Mr or Mrs. 500 (598 reputation)

Group: General Forum Members
Points: 598 Visits: 1033
I doubt there is an "elegant" way to do this via TSQL.

You might be better off trying the SQL CLR, I would imagine you could code against the Excel Object Model with it.
nick.mcdermaid
nick.mcdermaid
SSC Eights!
SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)

Group: General Forum Members
Points: 818 Visits: 782
Here is an outline of a simple method which does not require Excel to be installed:

1. Copy a blank worksheet on to your SQL Server called YourTemplateWorksheet.XLSX
2. EXEC xp_cmdshell 'COPY C:\YourTemplateWorksheet.XLSX C:\YourNewWorksheet.XLSX'

This is over simplified but hopefully you get the idea. You need to run the usual gamut of security issues around xp_cmdshell
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