how to filter with some values in a column. The Filtered values are in excel. The values should be filtered with the values in that column.
You can read the data of an excel with the help of UiPath Excel activities (Read range activity under Excel application scope). Take the output in a variable which will be of type Datatable. Then filter the data of a column as you want. Filter can be done by below 2 ways.
- Use the filter activity of UiPath. Provide the column name on which u want to put filter and the value it should contain e.g Column A should be filter with value contain XXXX.
- Use LINQ query. Like YouDataTable.Aseneumberable(). where(Function(x) x.item(“ColumnName”).tostring.Equals(“Value”)).CopyTodataTable.
there are more values.so it should take from excel and the column values should be filtered.
Hi Can you share your excel
you can use the linq query or filter datatable
for example
dt.asnumerable().where(function(x) x(“YourColumnName”).tostring.equals(“ColumnValue”)).CopyToDatatable
properties.xlsx (9.7 KB)
the sheet2 values should be filtered in sheet1
Read the Data:
Use Excel Application Scope and Read Range to read your data into DataTables (e.g., dtSource(Sheet1) for the main sheet and dtFilter(Sheet2) for the sheet containing the values you want to filter by).
Create a List of Values:
You can create a list of values from the dtFilter DataTable. This will be the criteria for filtering.
LINQ Query:
Use an Assign activity to perform the LINQ query, checking if the current row's value exists in the list.
Dim filterValues As List(Of String) = dtFilter.AsEnumerable().Select(Function(row) row.Field(Of String)("FilterColumnName")).ToList()
’ Filter dtSource based on the list of filter values
Dim filteredData As DataTable = (From row In dtSource.AsEnumerable()
Where filterValues.Contains(row.Field(Of String)(“ColumnName”))
Select row).CopyToDataTable()
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.