5

I'm using EPPlus 4.1.0.0, and I want to convert my excel sheet into a datatable.

There are few empty rows at the end of the excel file.

So while converting it, I am also getting the empty rows into datatable.

How do I remove the empty rows before converting it to a datatable?

MMalke
  • 1,857
  • 1
  • 24
  • 35
ashveli
  • 248
  • 6
  • 28
  • What does you code look like? Empty cells usually mean they contain whitespace like null length strings. – Ernie S Mar 21 '17 at 22:35

2 Answers2

3

Maybe check my answer here: https://stackoverflow.com/a/49232456/1114531

It is checking the last row if it is empty and if yes it deletes it and doing this until finds non-empty row. (non-empty means here: all columns in this row have some value)

Tomasz Kowalczyk
  • 1,873
  • 2
  • 23
  • 33
-1

You could use DeleteRow

 worksheet.DeleteRow(lastRow + 1, worksheet.Dimension.End.Row - lastRow - 1);
sports
  • 7,851
  • 14
  • 72
  • 129