title: Create new worksheets based on row data values
body: <p>I have a data set that I want to split into specific worksheets based on row values and export via my C# web app.</p>
  
  <p>Data columns (example): 
  <code>SerialNumber</code>, <code>ProductType</code>, <code>Location</code>, <code>Date</code> </p>
  
  <p>I need to loop through the record set sorted by column <code>Location</code> and then detect when that <code>Location</code> value changes so I can create a new worksheet and put data for each distinct <code>Location</code> in separate tabs/worksheets. </p>
  
  <p>I have been using the <code>LoadFromDataTable</code> method to pop data from my entire dataset into one worksheet but not sure this is the right method for an iteration</p>
  
  <p>What would I use while looping through my dataset so I can write data into the first sheet while evaluating the row value of the "location" field and then dynamically trigger new tabs/sheets as needed?</p>
  
  <p>I am a new 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 in my classic .asp app. </p>
  
  <p>Can anyone point me to an example of something like this in C# with dynamically spawned worksheets based on row values?</p>