I get very strange results when using the ColCountInRow function. They don't make any sense. With a certain Excel file that has more than 100 columns in almost all rows I mostly get numbers far below 100.
I think you might be confused about how ColCountInRow works. ColCountInRow gives you the count of non-empty cells in that row. So for example, for row 5 in your file, ColCountInRow=2, because row 5 has 2 cells (A5 and DY5)
If I understand correctly, what you would like to get for row 5, is MaxCol = DY = 129?
If you want that, you can get it with this code:
for row := 1 to xls.RowCount do if xls.ColCountInRow(row) > 0 then begin OutputDebug(InttoStr(row) +': ' +IntToStr(xls.ColFromIndex(row, xls.ColCountInRow(row)))); end;
You will normally get ColCountInRow together with ColFromIndex to get the actual column where the cells are. This allows you to process just 2 cells in row 5, instead of 129, from which 127 are empty.