For Each loops are very efficient. I had to get to like 5 million rows before any noticeable performance difference appeared. Even then it only took like 7 seconds to loop through all records. And the method proposed to avoid the loop was SLOWER.
https://forum.uipath.com/t/there-is-no-need-to-try-to-avoid-for-each-loops-on-large-amounts-of-data/