Add all values in a column of a data table

Hi my friends,

¿Is there any way to add all the values of a column of a Data Table obtained after a Read Range Activity, and assing the result into a variable?

Thanks in advance!

we can do (add by the understanding of value retrieval):
arrValues =
YourDataTableVar.AsEnumerable.Select(Function (x) x(YourColNameIrIndex).ToString).toArray

it will return us a string array and will work when the datatype of the data column is a simple datatype as string, int32, double…

About LINQ have a look here as well:

1 Like

Hello @dla - How about below expression

Variable of type double Output = DT.AsEnumerable.Sum(Function(x) Cdbl(x("Price")))
  • Replace DT with your data table name
  • Replace Price with your actual column name

Reference code - (10.2 KB)

Hi @dla ,

if you want to add column value plz check below workflow

ColumnValueAddToDataTable.xaml (10.1 KB)


Thank you a lot, it works!!

Thank you a lot!!

It`s also a soltion. I appologize I can only mark one answer as a solution.

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