This is a general problem with that Excel reading access:

The reader will never know when the last row is reached,
because some data could be written after 100s of empty rows.

So you need either a delimiter to mark the last line, if this is read you finish your loop,

or

skip reading after a number of lines which will never be filled with data.


But I would suggest the first solution, if you write the Excel files by your own.

Use the second, if you got the Excel file from someone else. Just assure that
the row lines will not exceed a special count. So you can read always 100
lines (but in real filled with data only up to 50-60 lines) or sth like that.