How do I iterate through rows in an excel table using epplus?

后端 未结 6 1239
暖寄归人
暖寄归人 2021-01-30 20:19

I am new to epplus, and i\'m trying to read some values from an excel table.

This is what I have so far:

var fileInfo = new FileInfo(filename);
using(var e         


        
6条回答
  •  佛祖请我去吃肉
    2021-01-30 20:56

    Here's a way to get the complete row as ExcelRange which then can be iterated or used for LINQ:

    for (var rowNum = 1; rowNum <= sheet.Dimension.End.Row; rowNum++)
    {
        var row = sheet.Cells[string.Format("{0}:{0}", rowNum)];
        // just an example, you want to know if all cells of this row are empty
        bool allEmpty = row.All(c => string.IsNullOrWhiteSpace(c.Text));
        if (allEmpty) continue; // skip this row
        // ...
    }
    

提交回复
热议问题