Hi
This is kind of critical issue. Attached 2 excel sheets. Just check the PayPalAccountAL tab alone. In US_Template.xlsx, when I do cells.getMaxDataRow() returns me 2 but in US_Template_2020.xlsx the same returns 1. Both attached xls although both are exactly same except column order. Below the code snippet how I parse and get the maxRow. Quick help will be greatly appreciated
Here is how I read
public Worksheet mergeALTemplate() throws Exception{
Worksheet sheet = workbook.getWorksheets().get(Sheet.PayPalAccountAL.name());
return mergeListingData(sheet, Section.PayPalAccountActivityLog);
}
private Worksheet mergeListingData(Worksheet sheet, Section section ) throws Exception{
Cells cells = sheet.getCells();
AtomicInteger startRow = getMaxDataRow(cells);
}
protected AtomicInteger getMaxDataRow(Cells cells){
int maxDataRow = cells.getMaxDataRow(); //this returns different value
for(Object obj : cells.getMergedCells()) {
CellArea cellArea = (CellArea)obj;
if (cellArea.EndRow > maxDataRow)
maxDataRow = cellArea.EndRow;
}
return new AtomicInteger(maxDataRow);
}
Archive.zip (327.4 KB)