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 6, 2013 11:13 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, July 17, 2014 12:46 PM
Points: 91, 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
Post #1520788
Posted Sunday, December 8, 2013 2:38 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 3,115, Visits: 3,235
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,
SQL Server developer at Seavus
www.seavus.com
Post #1520891
Posted Monday, December 9, 2013 4:04 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Yesterday @ 8:36 AM
Points: 72, Visits: 533
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: Thursday, December 11, 2014 10:00 PM
Points: 179, Visits: 592
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