in this i want to sum the row data i don’t want to use the loop to add it is their any function are their to sum the row data .
any one .
@akshaygm12 if it is present in excel we can add.
Check if this helps out ,
DataTable1.Columns[“TotalVal”].Expression = “C1+D1+E1”;
Create a new column , which would be based on a expression , and in the expression formula , give in the column names …
maybe try something like this …
its very crude , and can be structured better ,
You first Read your Excel and store it in a DataTable dta
Then the Sum of each row will be stored in a List , Let us take List A
List A= (From p In dta.Select Select(Convert.ToString(p.ItemArray.Sum(Function(x) If(IsNumeric(x), Convert.ToDouble(x),0))))).ToList
List A will Contain Sum of Each Row.
I have not tested the code, Please try this.
thanks its working.