How to select the data in two excels

Hi Team,

Scenario: I have two excels.in one excel i have 60k records and the columns are id,name salary

in second excel i have id and age.id is the primary key for both the excels.I want the user details name ,salary whos age is >75.How to select the data ?what is the best way of doing it?

Note:due to performance issues i am not preferring foreach and if activities.

Thanks in Advance

ok,but my question to you is how you can use excel as database.

@rpadev

First Read Your Excel Sheets1 and store it in dt1 and excel Sheet 2 in dt2.
Then Create a datatable dt3 .
Iam using Join here

Try this

dt3 = (From p In dt1.Select
Join q In dt2.Select
On p("ID").ToString Equals (q("ID").ToString)
Where Convert.ToInt32(q("Age"))>75
Select p).ToArray.CopyToDataTable.DefaultView.ToTable(False,"Name","Salary") 

Regards,
Mahesh

1 Like