Arthematic Operations for large Excel

Hi,

I have a large excel file in which there are two columns A, B (with 10,000 rows).
I want to do Column A - Column B and store it in Column C. The answers I have seen in forum till now performs the operations on the excel cells one-by-one by changing the cell value and looping it.
Is there any solution if we can take the data into dt and add column C in dt and then perform the operation. and then write it into the excel?

Any other efficient solutions are also welcome.

Thanks

Hi,
Please try loading into data table using excel application scope read range and then you can use for each to iterate through each row and then inside for each subtract ColA by ColB and then store in a variable and then move the variable a new data table which you should be creating before for each row activity.

Let us know if you need more suggestion on this

Regards,
Pavan H

Hi @Ayush_Purohit_IN

You can achieve this by following few steps.

  1. Use a Read Range activity to read the data from your excel to a data table.
  2. Use a Add Data Column activity to add a new column to the data table (Column C)
  3. Use a For Each Row activity to loop through the data table
  4. In the For Each Row activity within the loop and add the data to the new column

This is something similar which I have done to add a value to a new column
image
In your case, you can use
Int32.Parse(row("ColumnA").ToString) - Int32.Parse(row("ColumnB").ToString) to do the calculation

1 Like

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