int GetLastRowNumber() { IExcelSheet sheet = _app.GetActiveWorkbook().GetActiveSheet(); for (int r = ROW_FIRST_TRANSACTION;; r++) { var value = sheet.GetValue(r, COL_FIRST); if (value.IsNullObj()) { return(r - 1); } } return(-1); }