Hi, I have a sample excel and I have to find the sum of the column “TotalAmt” and the result should write after last row dynamically. Could any expert please kindly help.
Sum.xlsx (8.7 KB)
=> Use Read Range Workbook to read the excel and store the data into datatable say dt_ResultsData
.
=> Use the below syntax in Assign activity:
totalSum = dt_ResultsData.AsEnumerable().Sum(Function(row) Convert.ToDouble(row("TotalAmt")))
totalSum
is of datatype System.Double
=> Use the below syntax in Assign activity:
lastRowIndex = dt_ResultsData.Rows.Count + 2
=> Use Write Cell Workbook to write the total amount in next dynamic cell.
In Cell give "D" & lastRowIndex
In Cell Content give totalSum.ToString
Sequence3.xaml (8.4 KB)
Hope it helps!!