简体   繁体   中英

Dynamic Excel WorkSheets based on data tables using SSIS

Trying to create dynamic Excel WorkSheets based on data tables using SSIS.

Each Excel worksheet would represent a State and State work sheet would have different rows and columns.

For instance: AL - Alabama WorkSheet

A/C No Col1 Col2 Col3 ..... Col 39 (there are 39 columns)

1000 123 ABC 39j........49sd
2000 123 ABC 39j........49sd

FL - Florida WorkSheet

A/C No Col1 Col2 Col3 ..... Col 39

1000 123 ABC 39j........49sd
2000 123 ABC 39j........49sd

540K rows are involved so each worksheet would have around 54K records.

Let me know what's the best approach

This sounds like a parameterized SSIS package, to me. You can do this by creating variables to hold the parts of the data flow that will change (the state to search for, the name and path of the destination file) and setting those properties on the Excel and ADO.NET connection managers using expressions . At run time, you'd change the values of the variables and run the package.

Now, that's a very high-level summary. Going through it step by step would be too big a task for this setting, but here's an article that goes into how to do it in reverse (flat file to SQL). The basic concepts are the same, though, and, in particular, this article shows how to set expressions and variables in your package.

Best way to do anything in SSIS is script task.

Use Interop services for excel in Script task and create workbooks before dumping the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM