Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

need to create an excel sheet without any data in it Expand / Collapse
Author
Message
Posted Friday, December 06, 2013 11:13 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, March 31, 2014 9:35 AM
Points: 37, Visits: 133
Hi,
I need to create an empty excel sheet using T-SQL.
Can any one help me out in this?

Thanks in advance
Post #1520788
Posted Sunday, December 08, 2013 2:38 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 3:31 PM
Points: 2,721, Visits: 2,633
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.
Post #1520891
Posted Monday, December 09, 2013 4:04 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 61, Visits: 359
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.
Post #1521006
Posted Tuesday, December 10, 2013 12:08 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 6:32 PM
Points: 176, Visits: 527
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
Post #1521408
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse