It's hard to determine which specific step from your Script is taking longer to run, but I would guess it's probably the For loop. In a quick look, it seems that you cannot get rid from your loop, but we can maybe remove a few steps from there, which can save your Script some time.
You're basically capturing the qty of rows from your occupied range, looping it until you get to the total count, and for each index accessing the respective row value. Instead, I would recommend you to get the values from all rows from your worksheet, and then loop through it to execute your validations.
As example, I took an oversimplified scenario to test this approach, where I'm just accessing the values from 693 entire rows and using the map array method to loop through it and print its values in the console. The whole code is highlighted in red. This approach takes around 4 seconds to iterate all rows (in blue):
Then I did the same thing again, but now using a for loop and accessing each row value individually (in red), just like you did. This is the result:
I don't think you won't get a 90%+ improvement in your run time as I got with this veeeery simplified scenario, but it still worth the shot :)
Let me know if it works for you or if you need any additional help!
✅
If this solved your issue, please mark it as Accepted Answer.
👍
If it helped, feel free to give it a like!
🌐 Explore more Power Platform content on my
Website or on my ▶️
YouTube
💼 Find me on
LinkedIn