How to extract the account number in from one sheet to another sheet using uipath

Hi Team,

I have 2 excel sheets like sheet1 ( column - Account Number) and sheet2. ( Columns - Account Number, Contact Name and Customer Number)
In sheet1 have account number,. So, i want to check the same account number is available in the sheet2 or not?
If account number is available, i want extract the Customer Number and Contact Name data in the sheet2 based on the account number.

Can any have help me to slive the issue?.

Thanks.

Hello @Ramudu

You could read the two files to datatables with Read Range Workbook activity.

Then you loop the accounts (from table with only account numbers), and then use Lookup Datatable activity to check the index of the row.

If the index is below 0 then it means that the accounts number is not present.

If the index is above, then you can extract values by writing:

dt_AccountInfo.Rows(index)("Value")

Regards
Soren

Hey, please check below logic

lst_dtSheet1 as List(of String) = (from rw in dtSheet1.Enumerable() select x = rw("Account Number").ToString)

lst_dtSheet2 as List(of String) = (from rw in dtSheet2.Enumerable() select x = rw("Account Number").ToString)

lst_acc_not_available_in_sheet2 as List(of String) = (from acc in lst_dtSheet1 where not lst_dtSheet2.Contains(acc) select x = acc)

dt_new_Available_account_in_sheet2 as DataTable
dt_new_Available_account_in_sheet2 = (from rw in dtSheet2.Enumerable where lst_dtSheet2.Contains(rw("Account Number").ToString)).CopyToDataTable

Note: Please consider above for logic only. Code accordingly in UiPath.
If you face any issue let us know

Hi

Get column value filtering by another column
1-Validate if there are results under the Linq filter
2-If there are results then get the required value
3-If there are not results, then assign String.Empty

stringValue = If(dtTable.AsEnumerable().Where(Function(x) x(“ColumnNameToFilter”).ToString().Equals(“valueToFilter”)).Count() > 0, dtTable.AsEnumerable().Where(Function(x) x(“ColumnNameToFilter”).ToString().Equals(“valueToFilter”)).Select(Function(z) z.Field(Of String)(“ColumnNameToGetValue”)).First(), String.Empty)

@Ramudu

use join activity with left join

cheers