Get the total of a column from an Excel sheet

I have a list of purchases made for the week on an excel sheet with the amount of money spent on each line.
How can I assign to a variable, the total sum of column “F”.
I tried

TotalPrice = 0
For each row: TotalPrice = TotalPrice + Convert.ToInt32(row.Item(5).ToString.Replace(",",""))

But kept getting 0 as the output.
Please help!

@dvn Try using Convert.ToDouble

Hi @dvn

Can you attach workflow or screenshot?

Here it is with the full information at the bottom

TotalPrice = 0
For each row: TotalPrice = TotalPrice + Convert.ToInt32(row.Item(5).ToString.Replace(",",""))

When I try to input the new TotalPrice somwhere else, I would expect the some of all the spendings but instead I get 0

Hi @dvn,

for this you use following code in Assign activity after the read range activity.

SumCol = (DT.AsEnumerable().Sum(Function(r) Convert.ToDouble(r(5).ToString.Replace(",",""))))

DT —> Output var of Read Range.
SumCol —> Should be of type System.Double

You can use MessageBox with variable SumCol to check the value.