Hello @fba008
You could try to use a dynamics selector to check if there is a line, if it has, UIPath updates and look for the next line, if not terminate process.
Check this link to see you can understand better how the dynamics selector works: What is best practice to select dynamic selector
Regards