I'm trying to select just the rows from an Excel spreadsheet that have data in the first column.
Here's the code I'm using:
IEnumerable<Row> dataRows =
from row in worksheet.Descendants<Row>()
where (row.RowIndex > 2
&& row.Descendants<Cell>().First().CellValue != null)
select row;
When I run this code, the debugger tells me "Error in implicit conversion. Cannot convert null object."
I can't figure out what the null object is. I assume that each row has a non-null first cell (though, of course, the CellValue of the cell in question may be null).
Can anyone tell what I am doing wrong here?
Thanks in advance for your help.