How to add two column of the data table and paste it into third column

Hi All,

I have a datatable variable dt in which I have datatable extracted from a excel.

In that datatable I need to add the values of two column together and paste it into the third.

Column A , Column B values added and a new column C is added to the same datatble and sum of column values of A and B pasted there i.e in column C

Please help.

1 Like

what’s the value on Column A and Column B??
is it Maths related or Just text?

the value is math related. They are numbers
987989 ,9878.09 ,8678.98

Since this is extracted from Excel, This can be handled in the same itself.

write Cell with the Formula of Add Column A and B .
Then Auto fill range for the rest of the cell in the column.

Hi @Karan28

I have created workflow based on your requirement please unzip and run check Test.xlsx file.
Here I took input for ColumnA,ColumnB and I added those two columns into ColumnC.
I hope you will get solution (20.1 KB)

Kommi Jeevan.

1 Like

Cheers @Karan28 if you find it useful mark it as solution and close the thread.

Hi thanks for the solution but I am getting this error

Get Row Item: StringConverter cannot convert from System.Double.

I am getting the same error but for a different post.

@Karan28 - I think it has something to do with being a string variable when it should be an integer variable.

if you have a datatable called dt_ExcelData, with columns: Name, Salary & Bonus and you need a new column called Total Salary (Salary + Bonus)

  1. Use Add new Column activity “Total Salary” - at the required place in your workflow
  2. Add an assign activity
    Put this in the left-hand side of the assign dt_ExcelData.Columns(“Total Salary”).Expression
    Put this in the right hand side "Income+Bonus"

After this point you should now have the calculated value for all rows in the table without using a loop.