How to get the entire row based on the cell value in UiPath

How to get the entire row based on the cell value from excel sheet

1 Like

Use excel application scope then use read range pass the value for datatble variable and use foreachrow to iterate per row

@BasiReddy

2 Likes

@BasiReddy welcome to the community! When you say based on the cell value, is there a specific condition you need to specify? Could you provide us with an example so we can better help?

Hi @BasiReddy

You can perform the following steps:

  1. Read the excel file to get a DataTable
  2. Once you get that, you can apply a LINQ expression to get the row (i.e. Where, Select)
    YourDataTable.AsEnumerable().Where(function(row) row(“ColumnName”).ToString().Equals(YourSearchedValue)).FirstOrDefault()

Be careful, in case of the value is not founded into you data table, the FirstOrDefault method throws an exception, you can manage that using an Default row or count the amount results of the LINQ query before to assign it to a dataRow

Read the whole file in using Read Range
Then you can use the Filter Data Table activity

image

When i declare Department ID was BPO, bot needs to fetch all those entire rows whose department ID is “BPO”

Thank you!!

I have attached a image for clear understanding

So with Filter Data Table activity -
Set Column to “Department ID”
Set Operation to =
Set Value to BPO

You can assign Column and Value to variables if you need to amend depending on requirement.

Thank you for responding quickly,
I did the same process but I am getting confused , how to get the entire row

Just a tip, dont do your whole workflow inside the excel scope unless you need to…

image

Getting below message

Can you please help me

You need to use Output Datatable Activity first to put it to a string value

Hi TimK,

Can you please help me by creating one project based on this scenario.