0

In EPPlus it's very easy to delete a column, the code is as follows:

using (ExcelPackage xlPackage = new ExcelPackage())
{
    xlPackage.Workbook.Worksheets.Add("Summary");
    xlPackage.Workbook.Worksheets["Summary"].DeleteColumn(21);
}

Is it possible to "not delete", but instead clear all values in a given column, maybe something like this?

using (ExcelPackage xlPackage = new ExcelPackage())
{
    xlPackage.Workbook.Worksheets.Add("Summary");
    xlPackage.Workbook.Worksheets["Summary"].Column(21).Clear();
}

I don't see a method for this in EPPlus, and while there are similar questions, I haven't found anyone else attempting to do this on entire columns.

David Rogers
  • 2,601
  • 4
  • 39
  • 84
  • A column is simply a range with a width of 1. Even a cell is a range with a width and height of 1. You can address an entire column the same way you address any range in excel, ie `B:B` will address the second column – Panagiotis Kanavos May 24 '18 at 14:41

1 Answers1

0

Per @PanagiotisKanavos comment I've done it this way, should work, still wondering if there is another more elegant way to do it:

worksheet.Cells["U:U"].Clear();
David Rogers
  • 2,601
  • 4
  • 39
  • 84