Sagar_Sukla
(Sagar Sukla)
1
Hi i have a task that bot need extract the value from web and after extrating it has two columns
- I need to add the column values and write to another excel sheet of those columns of value1 and value2
Input =
Column1 column2
10 10
5 12
Output =
15 22
This way
How can i achieve this one can any one help
@Palaniyappan
1 Like
@Sagar_Sukla
after writing data to excel
use read range activity for reading the first excel
use 2 assign activity
outputvalue1=dt.AsEnumerable.Sum(Function(x) cint(x(“ColumnName”).ToString))
outputvalue2=dt.AsEnumerable.Sum(Function(x) cint(x(“Columnname”).ToString))
use write cell or add datarow activity to write the values in another sheet
cheers
Palaniyappan
(Palaniyappan P )
3
Hi
Hope the below steps would help you resolve this
-
Let’s take u have the datatable named dt
-
Now get the sum value like this for those two columns
int_sum_1 = dt.AsEnumerable().Sum(Function(row) cint(row(“Columnname_1”)))
int_sum_2 = dt.AsEnumerable().Sum(Function(row) cint(row(“Columnname_2”)))
Where both are integer varivale
In cint doesn’t work try with double like this cdbl
-
Now use a assign activity like this
Dtfinal = dt.Clone
-
Then use clear datatable activity and pass dtfinal as input and output
-
Now use add Datarow activity and mention like this
ArrayRow = {int_sum_1.ToString, int_sum_2.ToString}
And datatble as dtfinal
-
Finally use a write range activity where pass dtfinal as input and enable add headers property
Hope this helps
Cheers @Sagar_Sukla
1 Like
system
(system)
Closed
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.