I have a data flow component, comprise of the following :
1.) Read Excel file
2.) “Script transformation component”
3.) Write to a flat file
Everything works fine, however I was trying to add header & footer.
Both header & footer are custom and have to be derived from the data in the file.
I can open the file in C# and write the low level code, but this seems to be a pretty common task & I thought there would be something generic.
Let me know if someone has done this.
The approach listed in the Toolbox.com article will certainly work. (You’ll need to add another data flow, but data flows are cheap.)
On the other hand, since you’ve already got a Script Component in your existing data flow, you can use that to generate the header and trailer rows.
First, change the SynchronousInputID of the Script Component output to
Noneso that you can generate additional rows:Next, update the ProcessInputRow() method and add a FinishOutputs() method along these lines:
This approach requires a bit more code but lets you do everything in one pass, which for sufficiently huge files may be important. (On the other hand, an Excel spreadsheet shouldn’t be that big …)