3

I need to create a statistical report in Excel and wondering if I can use SSIS to read data from the database (calculate the aggregated numbers) and load them into an Excel file with a specific layout. From what I can see, in SSIS 2008 R2, we don't have control on the target excel file, cell by cell, or perhaps I missed something. Is there any way to achieve it through SSIS?

enter image description here

Thanks for your help in advance.

4

If your SSIS package runs with the appropriate file system permissions, you can create a template Excel file with the desired formatting and copy that file to a new one (using a file system or script task) where the data will be exported. If the sheet will contain a variable number of cells that must be formatted, you can use conditional formatting in the template and have Excel apply the format based on actual column values or a formatting flag, say in a hidden column, which could be populated from the data.

See this article for an example of using a template. This article may also be helpful; it mentions an ingenious way to update specific cells.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.