I am trying to read an excel spreadsheet into memory but when I use worksheet.UsedRange.Rows.Count, the value return is incorrect. I have 1670 rows of data in my spreadsheet but the row count brings back 694 rows.
var excelApp = new Microsoft.Office.Interop.Excel.Application {Visible = false};
var workbook = excelApp.Workbooks.Open(_mirrorFileName,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
var worksheet = (Worksheet)workbook.Worksheets[1];
var excelRange = worksheet.UsedRange;
var valueArray = (object[,])excelRange.Value[XlRangeValueDataType.xlRangeValueDefault];
var rowCount = worksheet.UsedRange.Rows.Count;
Should I be using UsedRange to find the row count or is there another method???