I have a scenario to create and populate data in Excel sheet dynamically. Data is available in Sql Server. I am capturing the Sql table data into Object Variable and then In the Execute Sql Task with Excel Connection how can i use this Object Variable as a table to do a select * into SheetName from [User::Object] ?
Note: The column names are not constant.They change for every run.
There are a few ways to get this task done:
Via ADO Enumerator:
By using the
foreach looptask and choosingADO Enumerator.An example: Implementing Foreach Looping Logic in SSIS
The data source as an ADO recordset:
This is perhaps a harder way because the data source to be created programmatically using C# by parsing incoming
object variable. Then, it can be used to load data into excel destination by leveraging a mere dataflow:An example: Using The SSIS Object Variable As A Data Flow Source
Update: Because of new requirement - column names are dynamically assigned:
The Excel file also to be programmatically created using C#: