In the excel Reader class file , when I call getrowcount method, why do i get a count of (-1). I should get a count of 5 rows . How can i fix it?
I look at the method written for it , why does it say -1,
public int getRowCount(string sheetName)
int index = workbook.GetSheetIndex(sheetName);
if (index == -1)
sheet = workbook.GetSheetAt(index);
int number = sheet.LastRowNum + 1;
Instructorgunjan Reply on 17/08/2019
Please add a new Excel file and then try again. And also, make sure you close the excel file while executing your code.