Sum and count of Excel rows

@Olivera_Kalinic

do one thing I guess your datatable is having more columns

so create a new datatable with 3 columns and datatype string using build datatable (newdt)

and then change this in the code

  1. coun = grp.Count.ToString
  2. s = grp.sum(function(x) x(“column”).ToString).ToString
  3. Select r = newdt.Rows.add(ra)).CopyToDatatable()

We are changing this because to write to same table the table already you have is having more columns than required(3).so we are creating a new datatable with 3 columns and adding data to that

cheers