{"id":4673,"date":"2018-08-25T03:23:32","date_gmt":"2018-08-25T03:23:32","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=4673"},"modified":"2024-07-26T08:41:03","modified_gmt":"2024-07-26T08:41:03","slug":"create-excel-report-in-ssis-using-template","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/","title":{"rendered":"Create Excel Report in SSIS using a template (Export Formatted xlsx File)"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>In our previous post we saw how to <a href=\"https:\/\/zappysys.com\/blog\/ssis-export-to-excel-dynamically\/\" target=\"_blank\" rel=\"noopener\">create excel dynamically in SSIS<\/a>. Now let&#8217;s advance further and find out how to create Excel reports in SSIS using Powerful <strong>Template engine (introduced in PowerPack 2.7.4)\u00a0<\/strong>\u00a0In this post you will learn how to use <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-export-excel-file-task\/\" target=\"_blank\" rel=\"noopener\">ZappySys Export Excel Task<\/a> to export data from Multiple SQL Tables to Single or Multiple Excel Sheets, we will use Formatting, Expressions and Filtering to export parent child datasets (Master-Detail) using Template approach which supports full customization as per your need.<\/p>\n<p>We will be using following\u00a0<a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys SSIS PowerPack<\/a>\u00a0component to make things work in this tutorial:<br \/>\n<div class=\"su-table su-table-alternate\">\n<table style=\"height: 59px\" width=\"503\">\n<tbody>\n<tr style=\"line-height: 0px\">\n<td width=\"50px\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5033\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png\" alt=\"ssis-export-excel-file-task\" width=\"128\" height=\"128\" \/><a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-export-excel-file-task\/\" target=\"_blank\" rel=\"noopener\"><br \/>\n<\/a><\/td>\n<td style=\"vertical-align: middle\"><a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-export-excel-file-task\/\" target=\"_blank\" rel=\"noopener\">SSIS Export Excel File Task (Dynamically generate)<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>You can check the following video to learn basic things about Export Excel Task. In future we will post video tutorial to show how Template engine works.<\/p>\n[youtube https:\/\/www.youtube.com\/watch?v=PXuOWo0xMoc&amp;w=560&amp;h=315]\n<h2>Requirements<\/h2>\n<ol>\n<li>First of all, MS Excel installed.<\/li>\n<li>Secondly, an Excel template that you can download\u00a0<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/template.xlsx\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<li>In addition, you will need SQL Server installed.<\/li>\n<li>Aso, the SQL Server <strong>Northwind sample database<\/strong> that you can download\u00a0<a href=\"https:\/\/github.com\/microsoft\/sql-server-samples\/blob\/master\/samples\/databases\/northwind-pubs\/instnwnd.sql\" target=\"_blank\" rel=\"noopener\">here.<\/a><\/li>\n<li>Additionally, SSDT for Business Intelligence.<\/li>\n<li>Finally, use the SSIS Excel package example that you can download\u00a0<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ExcelExport_TemplateReport.zip\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<\/ol>\n<h2>Concept about Excel Template Engine<\/h2>\n<p>ZappySys Export Excel Template engine is compatible with <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html\" target=\"_blank\" rel=\"noopener\">FlexCel engine described here<\/a>. So read it carefully to get most details about how template engine works and what elements supported in Template engine. Basically you have to use Template file which will be used to generate final excel report in SSIS. Advantage of Template engine approach compared to Simple export is you can control every aspect of your report. Also you can create nested reports use multiple datasets in a single sheet (Master-Detail JOINS) which is not possible in default export mode. The only down side of this approach is&#8230; learning curve. However once you understand concepts of Template Engine it wont take you too much time to master it.<\/p>\n<p>In Template file you can define bands (e.g. Customer Info, Order Info&#8230;). Each band can grow in Vertical or Horizontal direction. Band must be created by <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html#named-ranges\" target=\"_blank\" rel=\"noopener\">Named Range<\/a> in Excel. You must name your range in a very specific way. Based on how you suffix and prefix your named range it will decide how to grow your band (i.e. Expand Vertical or Horizontal).<\/p>\n<p>Few things to remember with Template Engine.<\/p>\n<ul>\n<li>Each Template file must have at least one\u00a0<a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html#named-ranges\" target=\"_blank\" rel=\"noopener\">Band<\/a> which can be used to attach Dataset.<\/li>\n<li>Each Template file must have <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html#configuration-sheet\" target=\"_blank\" rel=\"noopener\">Config Sheet<\/a> somewhere.<\/li>\n<li>You can use many functions in your Template using <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-tag-reference.html\" target=\"_blank\" rel=\"noopener\">Tag system<\/a><\/li>\n<li>You can define Charts, Graphs any elements you like in Excel Template and link to Ranges you define.<\/li>\n<\/ul>\n<h2>Getting started<\/h2>\n<p>In next few section we will see step by step instructions on how to use export SQL server data to Excel using Template File approach.<\/p>\n<h3>Prepare Sample Tables (Source data)<\/h3>\n<p>In this example, we will create an Excel report based in two SQL Server\u00a0tables from the Northwind database mentioned in the requirements. We are going to use Northwind dataset. You can download <a href=\"https:\/\/zappysys.com\/downloads\/files\/nw.zip\">SQL Script file from here<\/a>. Just download \/ extract and run it in SSMS to create necessary Tables with Sample Data.<\/p>\n<ol>\n<li>First of all, we will see the data displayed in the Customer table:\n<div id=\"attachment_4679\" style=\"width: 526px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-northwind-customer-table.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4679\" class=\"wp-image-4679 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-northwind-customer-table.png\" alt=\"Northwind table customer\" width=\"516\" height=\"403\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-northwind-customer-table.png 516w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-northwind-customer-table-300x234.png 300w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/a><p id=\"caption-attachment-4679\" class=\"wp-caption-text\">Northwind table in SQL Server<\/p><\/div><\/li>\n<li>Secondly, we will check the data of the Orders table. Note that the\u00a0CustomerID is included in this table, so we can create a master-detail\u00a0report based on these 2 tables:\n<div id=\"attachment_4680\" style=\"width: 531px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-orders.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4680\" class=\"wp-image-4680 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-orders.png\" alt=\"SQL Server Order table\" width=\"521\" height=\"449\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-orders.png 521w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/sql-server-orders-300x259.png 300w\" sizes=\"(max-width: 521px) 100vw, 521px\" \/><\/a><p id=\"caption-attachment-4680\" class=\"wp-caption-text\">SQL Server Orders<\/p><\/div><\/li>\n<\/ol>\n<h3>Prepare Excel Template<\/h3>\n<p>Now let&#8217;s create a\u00a0 template file which will be used to share our exported file. To make demo simple we will use this already prepared\u00a0<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/template.xlsx\" target=\"_blank\" rel=\"noopener\">template file<\/a>. Lets understand how template file was created.<\/p>\n<p>We assume you have read concepts of template engine by reading <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html\" target=\"_blank\" rel=\"noopener\">this link<\/a>.<\/p>\n<p>Basically few things to check in Template file<\/p>\n<ol>\n<li>Defining correct Config Tab (Only needed if you are using special features such as reusable expression, or filters (i.e. subset of data).<\/li>\n<li>Defining bands which is bound to dataset<\/li>\n<\/ol>\n<h4>Define Reusable Configuration Settings ( &lt;#Config&gt; tab )<\/h4>\n<p>In our example we are creating 2 extra tabs (UK, US) using filter expression (subset of dataset) so we need to use Config setting for that purpose. Notice that Config tab must be names as <strong>&lt;#Config&gt;<\/strong> and Reusable sections for Data, Format and Expression must be defined as below Cell A10 , Cell H10, Cell L10.<\/p>\n<div id=\"attachment_4941\" style=\"width: 727px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-excel-report-template-config.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4941\" class=\"size-full wp-image-4941\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-excel-report-template-config.png\" alt=\"Define Config Settings for Excel Report\" width=\"717\" height=\"322\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-excel-report-template-config.png 717w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-excel-report-template-config-300x135.png 300w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/a><p id=\"caption-attachment-4941\" class=\"wp-caption-text\">Define Config Settings for Excel Report<\/p><\/div>\n<h4>Create Bands<\/h4>\n<p>Now let&#8217;s look at how we define bands in template file. Read more about different types of\u00a0<a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html#named-ranges\" target=\"_blank\" rel=\"noopener\">bands<\/a> in Excel Template Engine. Band are defined using Named ranges. In our example we use two bands in first <strong>Sheet1<\/strong>.<\/p>\n<ul>\n<li>For customer data __<strong>cust<\/strong>__\u00a0 (start \/ end with <strong>double underscore<\/strong>)<\/li>\n<li>For orders data __<strong>ord<\/strong>__<strong>X<\/strong> (Read more on <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/reports-designer-guide.html#x-ranges\" target=\"_blank\" rel=\"noopener\">&#8220;X&#8221; ranges<\/a> )<\/li>\n<li>For US tab\u00a0 __<strong>cust_us<\/strong>__<\/li>\n<li>For UK tab __<strong>cust_uk<\/strong>__<\/li>\n<\/ul>\n<div id=\"attachment_4942\" style=\"width: 812px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-report-template-design.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4942\" class=\"size-full wp-image-4942\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-report-template-design.png\" alt=\"Designing Excel Report Template (Define Ranges for Master-Detail Report)\" width=\"802\" height=\"413\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-report-template-design.png 802w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-report-template-design-300x154.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-report-template-design-768x395.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/a><p id=\"caption-attachment-4942\" class=\"wp-caption-text\">Designing Excel Report Template (Define Ranges for Master-Detail Report)<\/p><\/div>\n<div id=\"attachment_4943\" style=\"width: 527px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-using-filter-for-excel-reports.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4943\" class=\"size-full wp-image-4943\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-using-filter-for-excel-reports.png\" alt=\"Using Filter (Subset of data) in Excel Report\" width=\"517\" height=\"256\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-using-filter-for-excel-reports.png 517w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-using-filter-for-excel-reports-300x149.png 300w\" sizes=\"(max-width: 517px) 100vw, 517px\" \/><\/a><p id=\"caption-attachment-4943\" class=\"wp-caption-text\">Using Filter (Subset of data) in Excel Report<\/p><\/div>\n<h3>Create SSIS Package<\/h3>\n<p>Now let&#8217;s use Our sample package to get started. You can create your own Package but we have already created one to make demo simple.<\/p>\n<ol>\n<li>In an SSIS project add the <a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ExcelExport_TemplateReport.zip\" target=\"_blank\" rel=\"noopener\">Demo SSIS package<\/a> from the step 5 of\u00a0the requirements:\n<div id=\"attachment_4682\" style=\"width: 363px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-add-existing-package.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4682\" class=\"size-full wp-image-4682\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-add-existing-package.png\" alt=\"Add package SSIS\" width=\"353\" height=\"284\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-add-existing-package.png 353w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-add-existing-package-300x241.png 300w\" sizes=\"(max-width: 353px) 100vw, 353px\" \/><\/a><p id=\"caption-attachment-4682\" class=\"wp-caption-text\">SSIS add package<\/p><\/div><\/li>\n<li>In addition, in the SSIS project, drag and drop the ZS Export Excel task\u00a0and <strong>Create a connection<\/strong> to the Northwind Database by clicking New for Source Connection.<\/li>\n<li>and enter\u00a0the source tables\/queries you like to use in your report. In our example, we will use two tables.<br \/>\nSyntax for Source data is <span class=\"lang:default highlight:0 decode:true crayon-inline \">alias1=Table1_Or_Query1 |\u00a0alias2=Table2_Or_Query2 &#8230;.\u00a0<\/span><br \/>\nIn this example, we will use\u00a0\u00a0<strong>cust= select * from dbo.Customers | ord=dbo.orders<\/strong>.<br \/>\nYou can also use just the table names for both e.g.\u00a0<strong>cust=dbo.Customers | ord=dbo.orders<br \/>\n<\/strong><\/p>\n<div id=\"attachment_4683\" style=\"width: 839px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-sql-server.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4683\" class=\"size-full wp-image-4683\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-sql-server.png\" alt=\"Export SSIS to Excel\" width=\"829\" height=\"633\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-sql-server.png 829w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-sql-server-300x229.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-sql-server-768x586.png 768w\" sizes=\"(max-width: 829px) 100vw, 829px\" \/><\/a><p id=\"caption-attachment-4683\" class=\"wp-caption-text\">Source table\/query for Excel Report<\/p><\/div>\n<p>&nbsp;<\/li>\n<li>Check the option to <strong>Use Template Engine<\/strong> To get the access to Excel Report Template Tab.\n<div id=\"attachment_9742\" style=\"width: 736px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/export-excel-use-template-engine.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-9742\" class=\"wp-image-9742 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/export-excel-use-template-engine.png\" alt=\"Use Template Engine\" width=\"726\" height=\"282\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/export-excel-use-template-engine.png 726w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/export-excel-use-template-engine-300x117.png 300w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/a><p id=\"caption-attachment-9742\" class=\"wp-caption-text\">Use Template Engine<\/p><\/div><\/li>\n<li>Now go to Excel Report Template tab, enter the path of the <a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/template.xlsx\" target=\"_blank\" rel=\"noopener\">template file<\/a> which we downloaded in\u00a0step 2 of the requirements and write the relationship between the customer and order tables (<strong>cust.CustomerID=ord.CustomerID<\/strong>):\n<div id=\"attachment_4684\" style=\"width: 839px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-template.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4684\" class=\"wp-image-4684 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-template.png\" alt=\"Specify template file for Excel report, define relationship for master-detail report\" width=\"829\" height=\"633\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-template.png 829w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-template-300x229.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-template-768x586.png 768w\" sizes=\"(max-width: 829px) 100vw, 829px\" \/><\/a><p id=\"caption-attachment-4684\" class=\"wp-caption-text\">Specify template file for Excel report, define relationship for master-detail report<\/p><\/div>\n<p>&nbsp;<\/li>\n<li>Finally, in the Target tab specify the path of the Excel Target and run\u00a0the package:\n<div id=\"attachment_4685\" style=\"width: 839px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-target-from-sql-to-excel-template.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4685\" class=\"size-full wp-image-4685\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-target-from-sql-to-excel-template.png\" alt=\"Excel output in SSIS based on a template\" width=\"829\" height=\"633\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-target-from-sql-to-excel-template.png 829w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-target-from-sql-to-excel-template-300x229.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-target-from-sql-to-excel-template-768x586.png 768w\" sizes=\"(max-width: 829px) 100vw, 829px\" \/><\/a><p id=\"caption-attachment-4685\" class=\"wp-caption-text\">SSIS target in Excel<\/p><\/div><\/li>\n<\/ol>\n<h3>Checking the results of the package to create an Excel Report in SSIS using a template<\/h3>\n<ol>\n<li>Once that you run the package, you can check the results. First of all,\u00a0we will check the Sheet1. It will contain the orders grouped by customerID:\n<div id=\"attachment_4687\" style=\"width: 527px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-result-excel.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4687\" class=\"size-full wp-image-4687\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-result-excel.png\" alt=\"SSIS exported from SQL Server to Excel\" width=\"517\" height=\"558\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-result-excel.png 517w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-result-excel-278x300.png 278w\" sizes=\"(max-width: 517px) 100vw, 517px\" \/><\/a><p id=\"caption-attachment-4687\" class=\"wp-caption-text\">Excel report exported in SSIS based on a template<\/p><\/div>\n<p>&nbsp;<\/li>\n<li>Secondly, in the US sheet in Excel, it will show the customers filtered\u00a0by the country where the country is US:\n<div id=\"attachment_4688\" style=\"width: 599px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-filter-export-excel-template-us.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4688\" class=\"size-full wp-image-4688\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-filter-export-excel-template-us.png\" alt=\"Filter data in Excel in a template\" width=\"589\" height=\"509\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-filter-export-excel-template-us.png 589w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-filter-export-excel-template-us-300x259.png 300w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/a><p id=\"caption-attachment-4688\" class=\"wp-caption-text\">filter data by country in Excel<\/p><\/div>\n<p>&nbsp;<\/li>\n<li>Also, in the UK sheet, it will show all the customers where the country\u00a0is equal to UK:\n<div id=\"attachment_4689\" style=\"width: 267px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-filter-export-excel-template-uk.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4689\" class=\"size-full wp-image-4689\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-filter-export-excel-template-uk.png\" alt=\"Filter data by country\" width=\"257\" height=\"299\" \/><\/a><p id=\"caption-attachment-4689\" class=\"wp-caption-text\">Show data where the country is the United Kingdom<\/p><\/div><\/li>\n<\/ol>\n<h2>Add Dynamic Comments<\/h2>\n<p>Sometimes you might want to add dynamic comments. Several cells may need comments, similar to tooltips, which come from another data column in the database.<\/p>\n<p>To achieve this, add the comment to the cell in the template file and place a placeholder column under the specified column.<br \/>\n<div id=\"attachment_11128\" style=\"width: 553px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11128\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file.jpg\" alt=\"comment-excel-template-file\" width=\"543\" height=\"216\" class=\"size-full wp-image-11128\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file.jpg 543w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file-300x119.jpg 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/a><p id=\"caption-attachment-11128\" class=\"wp-caption-text\">Place the placeholder column under the specified column.<\/p><\/div>\n<p>This will allow you to achieve the desired output. The Excel file will be generated with comments in this format.<br \/>\n<div id=\"attachment_11129\" style=\"width: 546px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file-output.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11129\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file-output.jpg\" alt=\"comment-excel-template-file-output\" width=\"536\" height=\"619\" class=\"size-full wp-image-11129\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file-output.jpg 536w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/comment-excel-template-file-output-260x300.jpg 260w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/a><p id=\"caption-attachment-11129\" class=\"wp-caption-text\">Excel File with Comments<\/p><\/div>\n<h2>Other Examples<\/h2>\n<p>There are many other examples of template engine use case <a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/samples\/csharp\/netframework\/reports\/index.html\" target=\"_blank\" rel=\"noopener\">found here<\/a>. Refer to related Github link and download xlsx files from Github. You can use those template file path to run demo in SSIS.<\/p>\n<h3>Pivot Table Example<\/h3>\n<p>For example to run Pivot Table demo using Template Engine download below files<\/p>\n<p><a id=\"57cd45330214e7aa8d9f92e02e34b095-cfa9f8db99217eb8c54e53e67f5fdf7cf732870f\" class=\"js-navigation-open\" title=\"Pivot Tables.template.xlsx\" href=\"https:\/\/github.com\/tmssoftware\/TMS-FlexCel.NET-demos\/blob\/master\/csharp\/VS2019\/netframework\/Modules\/20.Reports\/80.Pivot%20Tables\/Pivot%20Tables.template.xlsx\">Pivot Tables.template.xlsx<\/a><\/p>\n<p><a id=\"37a8e97c9558d4ac016b4d6eedf9dcdc-8976fe124812d71bd23534cee520df3f3822a1ec\" class=\"js-navigation-open\" title=\"ReportHeader.xls\" href=\"https:\/\/github.com\/tmssoftware\/TMS-FlexCel.NET-demos\/blob\/master\/csharp\/VS2019\/netframework\/Modules\/20.Reports\/80.Pivot%20Tables\/ReportHeader.xls\">ReportHeader.xls<\/a><\/p>\n<p>Found under below path<\/p>\n<p>https:\/\/github.com\/tmssoftware\/TMS-FlexCel.NET-demos\/tree\/master\/csharp\/VS2019\/netframework\/Modules\/20.Reports\/80.Pivot%20Tables<\/p>\n<p>&nbsp;<\/p>\n<h2>Conclusion<\/h2>\n<p>To conclude, we learned how to create a report from data in SQL Server and\u00a0export based on a template. The template not only included a nice format in\u00a0Excel, but also filter and relationships between two tables. If you liked\u00a0our\u00a0products, enjoy them <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\" rel=\"noopener\">HERE<\/a>.<\/p>\n<h2>References<\/h2>\n<p>For more information about creating an Excel Report in SSIS using a template,\u00a0refer to the following links:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.tmssoftware.biz\/flexcel\/doc\/net\/guides\/getting-started.html\" rel=\"noopener\">Getting Started with FlexCel Studio for the .NET Framework<\/a><\/li>\n<li><a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-export-excel-file-task\/\" rel=\"noopener\">SSIS Export Excel File Task (Dynamically generate)<\/a><\/li>\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=PXuOWo0xMoc\" rel=\"noopener\">SSIS Export Excel Task &#8211; Generate\u00a0Excel Dynamically<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In our previous post we saw how to create excel dynamically in SSIS. Now let&#8217;s advance further and find out how to create Excel reports in SSIS using Powerful Template engine (introduced in PowerPack 2.7.4)\u00a0\u00a0In this post you will learn how to use ZappySys Export Excel Task to export data from Multiple SQL Tables [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":5033,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,8],"tags":[21,12,369],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Create Excel Report in SSIS using a template (Export Formatted xlsx File) | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"This article will show how to create an excel report in SSIS using a template. The article will convert SQL Server information to an Excel template.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Create Excel Report in SSIS using a template (Export Formatted xlsx File) | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"This article will show how to create an excel report in SSIS using a template. The article will convert SQL Server information to an Excel template.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:published_time\" content=\"2018-08-25T03:23:32+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2024-07-26T08:41:03+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"128\" \/>\r\n\t<meta property=\"og:image:height\" content=\"128\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys Team\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/\",\"url\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/\",\"name\":\"Create Excel Report in SSIS using a template (Export Formatted xlsx File) | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png\",\"datePublished\":\"2018-08-25T03:23:32+00:00\",\"dateModified\":\"2024-07-26T08:41:03+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e\"},\"description\":\"This article will show how to create an excel report in SSIS using a template. The article will convert SQL Server information to an Excel template.\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png\",\"width\":128,\"height\":128},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Excel Report in SSIS using a template (Export Formatted xlsx File)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e\",\"name\":\"ZappySys Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g\",\"caption\":\"ZappySys Team\"},\"sameAs\":[\"https:\/\/zappysys.com\"],\"url\":\"https:\/\/zappysys.com\/blog\/author\/dcalbimonte\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Excel Report in SSIS using a template (Export Formatted xlsx File) | ZappySys Blog","description":"This article will show how to create an excel report in SSIS using a template. The article will convert SQL Server information to an Excel template.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/","og_locale":"en_US","og_type":"article","og_title":"Create Excel Report in SSIS using a template (Export Formatted xlsx File) | ZappySys Blog","og_description":"This article will show how to create an excel report in SSIS using a template. The article will convert SQL Server information to an Excel template.","og_url":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/","og_site_name":"ZappySys Blog","article_published_time":"2018-08-25T03:23:32+00:00","article_modified_time":"2024-07-26T08:41:03+00:00","og_image":[{"width":128,"height":128,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png","type":"image\/png"}],"author":"ZappySys Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ZappySys Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/","url":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/","name":"Create Excel Report in SSIS using a template (Export Formatted xlsx File) | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png","datePublished":"2018-08-25T03:23:32+00:00","dateModified":"2024-07-26T08:41:03+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e"},"description":"This article will show how to create an excel report in SSIS using a template. The article will convert SQL Server information to an Excel template.","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/08\/ssis-export-excel-file-task.png","width":128,"height":128},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/create-excel-report-in-ssis-using-template\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create Excel Report in SSIS using a template (Export Formatted xlsx File)"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/91b041e2dcf7ece5f068893c1a68ac6e","name":"ZappySys Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/746bec9c9d27f1b90bb181aa516ee234?s=96&d=mm&r=g","caption":"ZappySys Team"},"sameAs":["https:\/\/zappysys.com"],"url":"https:\/\/zappysys.com\/blog\/author\/dcalbimonte\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/4673"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=4673"}],"version-history":[{"count":28,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/4673\/revisions"}],"predecessor-version":[{"id":11131,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/4673\/revisions\/11131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/5033"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=4673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=4673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=4673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}