Extracting more than two column values from datatable based on specific column

Hello can anyone help in extracting more than two column values based on specific column match and if it matches then write the data from first datatable to other datatable.
I have used look up datatable and I have about 2000 rows so it is taking so much time. Please suggest me if there is any other method to do this.

@Gattu_Monika
in such scenario LINQ can help. Justr share some sample data from your case with us and we help you based in this. Thanks

1 Like

Example2.xlsx (355.6 KB)
Hii @ppr I have uploaded sample file where i need to copy two columns city and phone from sheet2 to sheet1 in already present columns with names place and mobile in sheet1 based on reference Column Name “ID” .I need to have data which is not matching of ID also in sheet 1.
i have kept required result pic.

thanks in advance

@Gattu_Monika
there are some different approaches available to do it. So let me share 2 of them, implementing close to your case but with a reduced and minimal different datastructure (but can be adopted very easy and quick by you).

The Join DataTable Approach:
FindMatches_1Col_JoinDataTable.xaml (10.5 KB)

  • is quick to implement, requires maybe later some column name renamings

A LINQ based approach:
FindMatches_1Col_fetchValues.xaml (10.1 KB)

  • is doing it all in one statement. Ready for cases without handling duplicates in dt2

Let us know your feedback

1 Like

Thanks @ppr I will try it.

@ppr It worked well.
Thankyou so much