Fetching data from one excel and comparing data with another excel

Hi everyone,
Here, i tried to fetch data from sheet1 of excel1 one, for eg:- ApplicationID = 74. These data is also available in another sheet of excel2. So if it available in another sheet then all the related data(column, Row) will be fetched otherwise ignore.

Hi Buddy @vishalk1

Welcome to uipath community

Kindly follow the below steps that could help you resolve this
–use a excel application scope and pass the file path of first file
–use a read range activity within this and get the output with a variable of type datatable named dt1, but make sure that this dt1 is with scope of whole sequence in the variable panel
–use another excel application scope and pass the file path of second file
–use a read range activity within this scope and get the output as dt2 a datatable variable
–hope you have the value obtained from first excel with a variable of type string named
in_value = “74”
–now use a for each row loop and pass the dt2 as input
–inside this use a if condition like this
row(“columnnameyouwanttosearch”).ToString.Equals(in_value)
if this above condition passes it will go to THEN part where we can have a activity like this with a assign activity (we need here a datacolumn with all the rows in it)
out_datacolumn = dt1.Columns(“yourcolumnname”)

Cheers @vishalk1

Hello @vishalk1
You can also Use Linq Here
Use this code in an Assign Activity

DT1.AsEnumerable().Where(function(row) DT.AsEnumerable().Select(function(r) r.Field(Of Int32)(“ID”)).Any(function(x) x = row.Field(Of Int32)(“ID”))).CopyToDataTable

What this’ll do is get all the matching columns
Check this workflow for better understanding
Linq.xaml (9.9 KB)

2 Likes

Thank you so much for suggestion. could you please attach any project you have?