Dynamically create new worksheets based on table data

Nov 10, 2015 at 1:41 AM
I have a data set which consists of data of different types that I want to put into specific worksheets..
Data columns:
SerialNumber, ProductType, Location, Date
I need to loop through the record set sorted by column "Location" and then detect when that "Location" data changes so I can create a new worksheet and put data for each location in separate tabs.

I have been using the LoadFromTable method to pop data from my dataset into the cells but not sure this will work

I have used the examples so I know the functions for creating worksheets but not sure how to get looping through my dataset so I can dynamically trigger the new tab and LoadFromTable into each sheet.

I am a new programmer to C# and am teaching myself (basically starting the rebuild of my app with this one task of multi-tab excel exports) I am familiar with this type of looping in vb script and have this type of export to single worksheet functionality in my classic .asp app.

Can anyone point me to an example of something like this in C# with dynamically spawned worksheets?