﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Integration Services / Data Warehousing  / Need to export excel sheet with SPECIAL formats / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 07:07:27 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]Phil Parkin (1/10/2013)[/b][hr] If people pledge enough beer money, I might even be tempted to investigate ... :-D[/quote]:-D Like your motivation :-D</description><pubDate>Fri, 11 Jan 2013 09:13:38 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]mister.magoo (1/10/2013)[/b][hr][quote][b]opc.three (1/10/2013)[/b][hr]Nice offering MM. The technique is one I have seen outlined before but not necessarily applied to SSIS. While no one step is difficult there are quite a few of them. What you have are the makings of an outline for a nice article on working with Excel in SSIS ;-)[/quote]Thanks for the nice words.Maybe it seems like a lot of steps, but it really is easy - just create the template, save it, unzip it and store it somewhere accessible.Then SSIS generates the Sheet.xml - easy enough - and zips it all up - easy enough.There are really only two steps to the SSIS part, unless you want to unzip it every time, but I can't see the point in that.It only gets more complicated if you also want to use the Shared Strings feature, but that is just another XML file to create in SSIS - one more step.As for an article...can I squeeze that in sometime in 2020 ... maybe?[/quote]I'm wondering whether that &amp;lt;sheet&amp;gt; XML could be produced in pure T-SQL. If someone took the time to work this out, it would be a real service to the community. If people pledge enough beer money, I might even be tempted to investigate ... :-D</description><pubDate>Thu, 10 Jan 2013 15:01:14 GMT</pubDate><dc:creator>Phil Parkin</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]opc.three (1/10/2013)[/b][hr]Nice offering MM. The technique is one I have seen outlined before but not necessarily applied to SSIS. While no one step is difficult there are quite a few of them. What you have are the makings of an outline for a nice article on working with Excel in SSIS ;-)[/quote]Thanks for the nice words.Maybe it seems like a lot of steps, but it really is easy - just create the template, save it, unzip it and store it somewhere accessible.Then SSIS generates the Sheet.xml - easy enough - and zips it all up - easy enough.There are really only two steps to the SSIS part, unless you want to unzip it every time, but I can't see the point in that.It only gets more complicated if you also want to use the Shared Strings feature, but that is just another XML file to create in SSIS - one more step.As for an article...can I squeeze that in sometime in 2020 ... maybe?</description><pubDate>Thu, 10 Jan 2013 06:06:25 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>Nice offering MM. The technique is one I have seen outlined before but not necessarily applied to SSIS. While no one step is difficult there are quite a few of them. What you have are the makings of an outline for a nice article on working with Excel in SSIS ;-)</description><pubDate>Thu, 10 Jan 2013 04:16:47 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]Phil Parkin (1/10/2013)[/b][hr]Wow - you've done this before? Nice.[/quote]Not in SSIS, but I have manually - just to learn how to - no reason not to do it in SSIS though.I actually found out about it because I was struggling with reading XLSX files in some bespoke software and decided to use the OpenXML SDK, which then taught me a bit about the structure of the xlsx file.</description><pubDate>Thu, 10 Jan 2013 02:39:16 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]mister.magoo (1/9/2013)[/b][hr]If you are using xlsx files, there is a way that is not too difficult if you are methodical...[ul][li]Create your template file with formatting and some sample data.[/li][li]Use your favourite zip tool (I like 7zip) to unzip the XLSX file (it is a zip archive that contains xml files)[/li][li]Navigate to the xl\worksheets folder to find the xml file for your worksheet(s)[/li][code="other"]e.g. Sheet1.xml[/code][li]Study the xml. You will see it contains a "sheetData" section which contains your sample data[/li][code="xml"]	&amp;lt;sheetData&amp;gt;		&amp;lt;row r="1" spans="1:4" x14ac:dyDescent="0.25"&amp;gt;			&amp;lt;c r="A1" t="s"&amp;gt;				&amp;lt;v&amp;gt;0&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="B1" t="s"&amp;gt;				&amp;lt;v&amp;gt;1&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="C1" t="s"&amp;gt;				&amp;lt;v&amp;gt;2&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="D1" t="s"&amp;gt;				&amp;lt;v&amp;gt;3&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;		&amp;lt;/row&amp;gt;		&amp;lt;row r="2" spans="1:4" x14ac:dyDescent="0.25"&amp;gt;			&amp;lt;c r="A2" s="4" t="s"&amp;gt;				&amp;lt;v&amp;gt;4&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="B2" s="3" t="s"&amp;gt;				&amp;lt;v&amp;gt;5&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="C2" s="2"&amp;gt;				&amp;lt;v&amp;gt;4441234&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="D2" s="1"&amp;gt;				&amp;lt;v&amp;gt;24883&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;		&amp;lt;/row&amp;gt;		&amp;lt;row r="3" spans="1:4" x14ac:dyDescent="0.25"&amp;gt;			&amp;lt;c r="A3" s="4" t="s"&amp;gt;				&amp;lt;v&amp;gt;4&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="B3" s="3" t="s"&amp;gt;				&amp;lt;v&amp;gt;5&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="C3" s="2"&amp;gt;				&amp;lt;v&amp;gt;4441234&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="D3" s="1"&amp;gt;				&amp;lt;v&amp;gt;24883&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;		&amp;lt;/row&amp;gt;	&amp;lt;/sheetData&amp;gt;[/code][li]Each "row" element represents a row in your sheet.[/li][li]Each "c" element represents a cell in the row[/li][li]The "r" attribute is the cell address[/li][li]the t="s" attribute tells Excel the cell contains a "Shared String" - read up on these - if you have a lot of repeating values you can use these to save space in the file. For Shared Strings, the "v" node contains the Shared String number.[/li][li]The "v" element is the cell value (or shared string number)[/li][li]Now all you have to do is reproduce the "Sheet1.xml" file in SSIS / SQL Query and then zip your new file along with the other supporting files back up into a new XLSX file that has all your original formatting[/li][/ul][/quote]Wow - you've done this before? Nice.</description><pubDate>Thu, 10 Jan 2013 01:45:43 GMT</pubDate><dc:creator>Phil Parkin</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>If you are using xlsx files, there is a way that is not too difficult if you are methodical...[ul][li]Create your template file with formatting and some sample data.[/li][li]Use your favourite zip tool (I like 7zip) to unzip the XLSX file (it is a zip archive that contains xml files)[/li][li]Navigate to the xl\worksheets folder to find the xml file for your worksheet(s)[/li][code="other"]e.g. Sheet1.xml[/code][li]Study the xml. You will see it contains a "sheetData" section which contains your sample data[/li][code="xml"]	&amp;lt;sheetData&amp;gt;		&amp;lt;row r="1" spans="1:4" x14ac:dyDescent="0.25"&amp;gt;			&amp;lt;c r="A1" t="s"&amp;gt;				&amp;lt;v&amp;gt;0&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="B1" t="s"&amp;gt;				&amp;lt;v&amp;gt;1&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="C1" t="s"&amp;gt;				&amp;lt;v&amp;gt;2&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="D1" t="s"&amp;gt;				&amp;lt;v&amp;gt;3&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;		&amp;lt;/row&amp;gt;		&amp;lt;row r="2" spans="1:4" x14ac:dyDescent="0.25"&amp;gt;			&amp;lt;c r="A2" s="4" t="s"&amp;gt;				&amp;lt;v&amp;gt;4&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="B2" s="3" t="s"&amp;gt;				&amp;lt;v&amp;gt;5&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="C2" s="2"&amp;gt;				&amp;lt;v&amp;gt;4441234&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="D2" s="1"&amp;gt;				&amp;lt;v&amp;gt;24883&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;		&amp;lt;/row&amp;gt;		&amp;lt;row r="3" spans="1:4" x14ac:dyDescent="0.25"&amp;gt;			&amp;lt;c r="A3" s="4" t="s"&amp;gt;				&amp;lt;v&amp;gt;4&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="B3" s="3" t="s"&amp;gt;				&amp;lt;v&amp;gt;5&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="C3" s="2"&amp;gt;				&amp;lt;v&amp;gt;4441234&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;			&amp;lt;c r="D3" s="1"&amp;gt;				&amp;lt;v&amp;gt;24883&amp;lt;/v&amp;gt;			&amp;lt;/c&amp;gt;		&amp;lt;/row&amp;gt;	&amp;lt;/sheetData&amp;gt;[/code][li]Each "row" element represents a row in your sheet.[/li][li]Each "c" element represents a cell in the row[/li][li]The "r" attribute is the cell address[/li][li]the t="s" attribute tells Excel the cell contains a "Shared String" - read up on these - if you have a lot of repeating values you can use these to save space in the file. For Shared Strings, the "v" node contains the Shared String number.[/li][li]The "v" element is the cell value (or shared string number)[/li][li]Now all you have to do is reproduce the "Sheet1.xml" file in SSIS / SQL Query and then zip your new file along with the other supporting files back up into a new XLSX file that has all your original formatting[/li][/ul]</description><pubDate>Wed, 09 Jan 2013 17:37:28 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]manibad (1/9/2013)[/b][hr]I mean if i choose special format under that home phone number means the data will be like this (XXX) YYY-TTTT...or if i am going to choose social security number data present in such a column would be like this XXX-YY-TIOP...Similarly date format too..[/quote]I am not seeing a way to achieve it. The formatting will be lost when you overwrite the cell with data. The column header formatting will persist which is all I have used the technique I outlined for. You may be able to get what you want by writing your data to the spreadsheet in a Destination Script Component or Script Task by via the Excel Object Model, but that is quite another undertaking from using a simple Excel Destination.</description><pubDate>Wed, 09 Jan 2013 16:08:42 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>I mean if i choose special format under that home phone number means the data will be like this (XXX) YYY-TTTT...or if i am going to choose social security number data present in such a column would be like this XXX-YY-TIOP...Similarly date format too..</description><pubDate>Wed, 09 Jan 2013 15:34:03 GMT</pubDate><dc:creator>manibad</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>When I am talking about formatting I am talking about bolding the text in a column header, or setting the background color or a column of cells. What kind of formatting are you talking about?</description><pubDate>Wed, 09 Jan 2013 14:55:06 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]opc.three (1/7/2013)[/b][hr][quote][b]manibad (1/7/2013)[/b][hr]I will list out the things what i have done.1.In data flow task,OLE DB source-&amp;gt;Sort-&amp;gt;Data conversion-&amp;gt;Excel destination(target is Format.xlsx(template file))2.In file system task,Source path is Format.xlsx(template) and destination file name is destiny.xlsx.Here the destination file is the copy of template file.3.Package will be executed in this order Dataflow task-&amp;gt;File system taskNote:Format.xlsx was placed after assigning the special formats to the worksheet.but still i am getting the exported file with general format.I dint get it with special formats.Now please tell me where i went wrong.So that i will be able to rectify it and proceed without making error.[/quote]Pre-requisite: open Format.xlsx (template file) in Excel and apply formatting as needed. Save to disk in original location as original name Format.xlsx.SSIS Workflow:1. In file system task, set to Copy source path Format.xlsx (template file) to destination file name is destiny.xlsx (copy of template file). Here the destination file is the copy of template file.2. In data flow task,OLE DB source-&amp;gt;Sort-&amp;gt;Data conversion-&amp;gt;Excel destination (target is destiny.xlsx (copy of template file))3. Package will be executed in this order File system task-&amp;gt;Dataflow task[/quote]after performing the above steps too i am unable to achieve my goal.I am unable to find where is the error.actually special format is nothing but the formats such as Zipcode,zipcode+4,Home phone number and social security number...this is what i have to achieve...</description><pubDate>Wed, 09 Jan 2013 14:51:30 GMT</pubDate><dc:creator>manibad</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]manibad (1/7/2013)[/b][hr]I will list out the things what i have done.1.In data flow task,OLE DB source-&amp;gt;Sort-&amp;gt;Data conversion-&amp;gt;Excel destination(target is Format.xlsx(template file))2.In file system task,Source path is Format.xlsx(template) and destination file name is destiny.xlsx.Here the destination file is the copy of template file.3.Package will be executed in this order Dataflow task-&amp;gt;File system taskNote:Format.xlsx was placed after assigning the special formats to the worksheet.but still i am getting the exported file with general format.I dint get it with special formats.Now please tell me where i went wrong.So that i will be able to rectify it and proceed without making error.[/quote]Pre-requisite: open Format.xlsx (template file) in Excel and apply formatting as needed. Save to disk in original location as original name Format.xlsx.SSIS Workflow:1. In file system task, set to Copy source path Format.xlsx (template file) to destination file name is destiny.xlsx (copy of template file). Here the destination file is the copy of template file.2. In data flow task,OLE DB source-&amp;gt;Sort-&amp;gt;Data conversion-&amp;gt;Excel destination (target is destiny.xlsx (copy of template file))3. Package will be executed in this order File system task-&amp;gt;Dataflow task</description><pubDate>Mon, 07 Jan 2013 11:22:49 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>I will list out the things what i have done.1.In data flow task,OLE DB source-&amp;gt;Sort-&amp;gt;Data conversion-&amp;gt;Excel destination(target is Format.xlsx(template file))2.In file system task,Source path is Format.xlsx(template) and destination file name is destiny.xlsx.Here the destination file is the copy of template file.3.Package will be executed in this order Dataflow task-&amp;gt;File system taskNote:Format.xlsx was placed after assigning the special formats to the worksheet.but still i am getting the exported file with general format.I dint get it with special formats.Now please tell me where i went wrong.So that i will be able to rectify it and proceed without making error.</description><pubDate>Mon, 07 Jan 2013 11:10:06 GMT</pubDate><dc:creator>manibad</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>The formatting will be pre-set in the "template" file. Open your "template" in Excel, adjust the formatting so it appears as you would like (e.g. bold column headers, background colors, etc.), save the "template" xlsx file and then close Excel. Then re-run your SSIS package. The outcome should be that the output file, the one you loaded data to, should also contain the formatting taken from the "template".</description><pubDate>Mon, 07 Jan 2013 10:43:28 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]opc.three (1/3/2013)[/b][hr]The only way to format an Excel Workbook programmatically using SSIS is to leverage the Excel Object Model from a Script Task.One technique I have used in the past however is to create a Workbook formatted the way I like and then use that to export into. When targetting an Excel Worksheet in an OLE DB Destination the formatting is ignored. So format your Workbook and save it as a "template" reachable by your SSIS package. In your SSIS package use a File System Task to copy the "template" into a new location and export your data from SQL Server into the copy.[/quote]Using file system task i was able to copy the file template from one location to other.Using data flow task i manipulated the source using source and then i coded to execute the file system task.In dataflow task,I sorted the data and then i connected with excel destination.Where the destination is the template.I am getting the output without special formats.Data flow task and file system task was completed successfully.What to do for rectifying the above and obtaining the desired output.</description><pubDate>Mon, 07 Jan 2013 10:30:02 GMT</pubDate><dc:creator>manibad</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]opc.three (1/3/2013)[/b][hr]The only way to format an Excel Workbook programmatically using SSIS is to leverage the Excel Object Model from a Script Task.One technique I have used in the past however is to create a Workbook formatted the way I like and then use that to export into. When targetting an Excel Worksheet in an OLE DB Destination the formatting is ignored. So format your Workbook and save it as a "template" reachable by your SSIS package. In your SSIS package use a File System Task to copy the "template" into a new location and export your data from SQL Server into the copy.[/quote]+1 to this second idea.Or, in a similar vein, have an Excel template which contains a 'Format' button &amp; associated VBA code to allow the formatting to be done by whoever opens the Excel file after the export has completed</description><pubDate>Fri, 04 Jan 2013 04:11:15 GMT</pubDate><dc:creator>Phil Parkin</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>Special formats for example...in excel sheet if you choose "Special format" under that "Social security number" the data specified in  such a column would be always in SSN format..I think i am clear...shld i explain more...:)</description><pubDate>Thu, 03 Jan 2013 22:15:08 GMT</pubDate><dc:creator>manibad</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>The only way to format an Excel Workbook programmatically using SSIS is to leverage the Excel Object Model from a Script Task.One technique I have used in the past however is to create a Workbook formatted the way I like and then use that to export into. When targetting an Excel Worksheet in an OLE DB Destination the formatting is ignored. So format your Workbook and save it as a "template" reachable by your SSIS package. In your SSIS package use a File System Task to copy the "template" into a new location and export your data from SQL Server into the copy.</description><pubDate>Thu, 03 Jan 2013 17:21:01 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>[quote][b]manibad (1/2/2013)[/b][hr]Hi,I need to export an Excel sheet with special formats (mandatory) where SQL is the source. I have achieved it using Scripts via script component in SSIS but my question is there any other way in doing it so.Please explain it if there is a way in doing it so.Thanks in advance:)[/quote]What do you mean special Formats?</description><pubDate>Thu, 03 Jan 2013 09:07:26 GMT</pubDate><dc:creator>Henrik Schütze</dc:creator></item><item><title>Need to export excel sheet with SPECIAL formats</title><link>http://www.sqlservercentral.com/Forums/Topic1402164-364-1.aspx</link><description>Hi,I need to export an Excel sheet with special formats (mandatory) where SQL is the source. I have achieved it using Scripts via script component in SSIS but my question is there any other way in doing it so.Please explain it if there is a way in doing it so.Thanks in advance:)</description><pubDate>Wed, 02 Jan 2013 21:35:36 GMT</pubDate><dc:creator>manibad</dc:creator></item></channel></rss>