@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.
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!
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")))