What performs better with excel

Hi guys.
Could you advice me which approach to choose working with excel:
The task is to to make some changes with excel file

Options to do it: 1- By doing write cell (excel) . 2- By using read range /for each row … / write range (back).

What is better to use for speed and perfomance?
Thanks

1 Like

@Slavich

Second approach is good and because at a time we are writing data using Write Range Activity and no need to open file multiple times.

If you are using Write Cell Activity and in that case we have to open the file multiple times to write into it.

2 Likes

And what if we open file - doing multiple write cell activities - and just after all activities closing. It is worth it?
Thank you

@Slavich

Its not good solution. Suppose, If you want to write in 10K rows then you need to use 10K Write Cell activities. So, instead of that use loop and assign values to it and finally use Write Range activity to write entire data into excel file at a time.

1 Like

Got it! Thank you.

1 Like

Hi Buddy @Slavich

I think both works good, the reason they suite at different situations
Let me explain one by one
for this

yes this is really good, but when is the question…!
This method of giving input to a excel can be used only when we changing the values along a COLUMN or along a ROW, any one at a time
like if we want to update all the rows in a single column (say in column A) we can use this activity WRITE CELL by mentioning the range as “A”+Counter.ToString where counter is a variable of type int32 with default value of 1 and the value we need to pass as input and, we need to keep this write cell activity inside a for each loop or a for each row loop, so that the values will be passed to all the rows in that column A
–But still, next to this write cell activity we need to increment the counter value as then only the rows will get increment and value will be passed consequently to the rows and not in the same row again and again, which can be done with a assign activity like this
counter = counter + 1
and this applies same to ROWS, like entering the values to all the columns in a single row…See how far this write cell activity is usefull and speedy enough to accomplish our task

Then this one

Well actually this is just a way to write the datatable in a excel thats all buddy
like we can pass the input as a datatable and the range to be written where as a output we will get this datatable in a excel, its actually single path that can only enter a datatable, but as a small changes in the excel file, this activity wont shine that much, but if we are just trying to write a datatable to a excel, this is really fast, but not suitable for small changes to be made, which can be done only with write cell…
Still we can make some changes to the input data to be written in excel BEFORE THIS WRITE RANGE activity like add data row and add data column and simple assign activities within for each row loop or for each loop, but those credits goes to those activities and not to the write range activity as it just writes the datatable to the excel

Hope this would help you buddy
Cheers @Slavich

1 Like

Hi @Slavich
Second approach is good but if we consider time complexity then in that case, you can use LINQ Query to assign values and then use write range activity at last.

1 Like

what if each cell has different values.

@kartik_sareen

Assign values like below. And finally use Write Range activity to write into excel file.

       row("ColumnName") = "Value"
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.