Consolidate Rows in Data Table

datatable
excel
activities

#23

@arivu96 - this is not were I have stucked. Am filtering the data’s from one excel sheet by column specific and adding the data’s dynamically to datatable and after that I have to write those data’s to excel sheet. Its working fine but its overwriting the data in the excel sheet row. So I just want to how to add multiple rows into a data table using add data row.


#24

Hi @Dilli
Did you find the solution I am facing the same issue.


#25

Hi,

This works perfectly when the type of the data column is predefined as int32. My situation is that I am outputting a datatable from Excel Application Scope and the data type of the column is Object. Using the solution that you provided, I got an error saying “assign invalid usage of aggregate function sum()”. could you provide an example showing how/where can I change the data type of the column while simulating your solution? Thanks a lot!

Best reagrds,
Lavina


#26

Hi,

Slightly more complicated but this should do the trick for the previous example.

Replace the asign result inside the For Eah by
dtAllRows.AsEnumerable.Where(Function(x) x("Name").ToString = row("Name").ToString).Sum(Function(r) CInt (r("#Apples")))

Cheers


#27

Thank you!


#28

@Dilli i am also facing the same issue, did you got the solution.


#29