Find first and last Row takes too much time


I’m currently working doing some reports with Excel, but one of the reports have more than 30k of rows, so when I try to use the activity find first and last row takes too much time… Somebody know if this could be due to the amount of data or if this activity has a limit before to decrease its performance.

I’m currently using Studio X, I tried to lookup for something similar in the forum, but I did not have luck, if you have seen any similar case, please let me know.


Would it be possible to use the DataTable.Rows.Count to figure out what the first and last rows after you read the data in?

Example if DataTable.Rows.Count = 30000 and your table has headers, then you can conclude that the last row is in position A:30001.

The first row is usually simpler because if your report header starts at A1, then the first data row is A2

Hi Andy,

Has sence… But is it possible to use that activity or code in Studio X? The most important thing for the case I’m preparing is last row, but I want to know if find first and last row in Studio X has a limit… I have used that activity for smaller files but this is this first one that give me this performance issue.

It is possible that you are hitting that limit because you are running this from StudioX directly.

Did you try to deploy the automation and run it from Assistant?

Remember, StudioX is a development environment. Running massive datasets through it is not the best thing to do. UiPath Assistant on the other hand is meant for running automations. Maybe you should try that path and see how it goes.


I haven’t tried it in a prod environment. Got your point, that might be the reason. I researched about this activity in its documentation, but I did not find anything related to this.

I think I will use a macro process for this step specifically.

Thank you

Great! Yes Macros can help because you are transferring the processing power down to Excel, and macros is a feature made for Excel. It’s a good way to keep Automation process logic separate from your excel-based business logic. This way your automation doesn’t have to change if business logic or the logic inside the macro changes.

thanks for the update.

@AndyMenon so what would automation do in this case ?? Just invoke the Excel macro ? if that’s the case, the why do we need automation for it ?

Well that depends on what the process is. We have automations that run macros on Excel spread sheets but that is just one little step in the larger process.

You can take all the business logic (from the macro) and throw it into the automation because you can and UiPath has activities that would help you with that.

But that would mean you are they tightly binding your automation to your logic. For small scale & limited team sizes it works well. You can support the automation and manage the changes for your team .

The problem is when it scales, that strategy won’t work very well.

Andy Menon
Founder, Lead RPA Architect & Engineer |