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


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 11:12 AM
Points: 2,934, Visits: 2,959
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: Thursday, August 28, 2014 3:22 AM
Points: 69, Visits: 495
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: Tuesday, August 26, 2014 8:56 PM
Points: 178, Visits: 571
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