Tag Archives: c#

EPPlus Columns

Creating a DataTable with EPPlus didnĀ“t work for me on some files.
Column was 10 but only 8 where created.

foreach (var cell in worksheet.Cells[1,1,1, worksheet.Dimension.End.Column])
{
  dt.Columns.Add(cell.Text);
}

Using this workaround at least worked

 int i = 1;

 while (i<worksheet.Dimension.Columns+1)
 {
 dt.Columns.Add("Column " + i);
 i++;
 }