Optimize execution time

excel
activities

#1

Hi All,

I have a script that does the following :

  • Access a maibox

  • Save attachments(Top 1)

  • Check for .xls in the attachments

  • Process the .xls ( multiple read cells and write cells ) / Compare to another excel sheet

I am looking for ways to optimize the execution time , currently it take about 2 mins to execute. How do I optimize the execution / Which of these operations should I focus for optimization.


#2

Hello!

You can focus in optimize the process of the .xls files. I think you’re using For Each Activity to loop through the cells, which is very slow in some cases.

My tip to this is use some LINQ/SQL Structure to manipule those values and compare with the other excel sheet.

Regards,


#3

I am already using LINQ to compare excel sheets.

The various reads and writes that I am doing are within each file.

I do the following :

  • Create a new sheet
  • Read individual cells X 10
  • Write in the new sheet X 10

I repeat the steps 2 & 3 ( 3 times)


#4

I don’t know if this will help, but in order to avoid looping through many rows in a table, you can use the .Select() function that will filter the data to the row you need rather than looping to find it.


#5

There’s a saying about assumptions in programming that I can’t remember now…
Check which operations take the most time and go from there - it probably is .xls writes, as it saves after each one, but that’s guessing. Profile it and see for yourself.