Filter Data in datatable based on column value in another sheet

Filter Data in datatable based on column value in another sheet

Use Case Description

Hi , Anyone please help me how to filter datatable based on the value from anothe sheet column value

Sheet 1 has single column (Itemnumber) with Unique Values
Sheet 2 has Master data and need to filter based on the sheet1 Itemnumber



Other information about the use case

Industry categories for this use case: Manufacturing

Skill level required: Beginners

UiPath Products that were used: UiPath Studio

Other applications that were used: -

Other resources: -

What is the top ROI driver for this use case?: Other

Hello @SIMIL

You can use Read Range activity to Read the 2 sheets.
Suppose sheet1 is read and we got the datatable DT1 and sheet2 datatable as DT2.

Then use a For each Row In Datatable activity on DT1.
Inside that use “Filter Datatable acitvity” and filter the value od DT2.

Hi ,
You can Join Dt1 and DT2 using Left join and keep the data table in Left as the one which you want in output and conditions can be for Item number in Both DT.

Hi Rahul, Thanks for the Reply .What could be the code for the fitlering ? I have assigned the each row of DT1 to a variable and i need to put that variable data as the filter criteria for DT2.

@SIMIL , when you use “For Each Row in datatable”, you can access the values in each row by their column names or column indexes.
Eg: CurrentRow(“Your Column name”)
Then this would be the code to filter DT2.

ResultDT = DT2.AsEnumerable.Where(function(row)row(“Column Name to filter”) = CurrentRow(“Your Column name”)).CopyToDataTable

After each iteration, ResultDT will be different based on the value in column of DT1. You may output ResultDTs or write them on excel sheets.

Best Wishes,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.