UIpath loop table data extraction

In my desktop app there is a table where it contains list of data and if I select data and click Ok the items will be gone on the list and I already have a logic that do that , no problem on it.

My question is how do we make the bot to keep on extracting data from the table using get visible text until there is no longer data on the table list and then bot will stop. So the bot will use get visible text and extract if the result is not empty bot will click Ok (files are gone) and then bot will check the list again if there are still data then repeat else stop. Is while loop a good solution to that ? what is the better idea ? Thank you.

image

Any idea . thanks.