title: Generate unique name for multiple worksheets in a for loop
body: <p>I am using <code>for</code> loop to generate some worksheets, and I want to give each one a unique name. All I get is <code>Sheet1</code>, <code>Sheet2</code>, <code>Sheet3</code>, and so on. </p>
  
  <p>Below is my code:</p>
  
  <pre><code>var package = new ExcelPackage();
  
  for (var i = 0; i &lt; ds.Tables.Count; i++)
  {
      var ws = package.Workbook.Worksheets.Add(String.Format("Sheet{0}", i));
  
      ws.Cells["A1"].LoadFromDataTable(i == 0 
          ? Transpose(ds.Tables[i].Copy()).DefaultView.ToTable() 
          : ds.Tables[i], true, TableStyles.Medium1);
  
      ws.Cells[ws.Dimension.Address].AutoFitColumns();
      ws.Cells["A:J"].Style.Numberformat.Format = "#,##0";                          
  } 
  </code></pre>