Get Category based on Name (Group data)

Hi all,

I wish to retrieve the Category data based on the Name from a Microsoft Excel.

Please see the screenshot below for better explanation:
image

If I use get row, it will only returns me that specified row value. For example, get row by Alex, it will only return me Male, not Fat and Obesity. Can I know is there a way where I can retrieve all Male, Fat and Obesity for Alex?

Hi @PacMan

Welcome to UiPath community
Kindly follow the below steps that could resolve your issue

  1. use excel application scope and pass the file path as input
  2. use read range activity and get the output as a variable of type datatable named out_dt
  3. use a for each row loop and pass the above obtained variable as input
  4. inside the for each row loop use a if condition like this
    String.IsNullOrEmpty(out_dt.Rows(out_dt.Rows.Index(row)+1)(0).ToString)
    If this condition gets passed it will go to the THEN part of if condition where we can mention like with a assign activity
    out_dt.Rows(out_dt.Rows.Index(row)+1)(0) = row(0).ToString

so this will now fill all the empty cell in a row with its previous name like this
Alex
Alex
Alex
Jason
Michelle
Kelvin

–now after this for each row loop we can again use another for each row loop and pass the same out_dt as input as this datatale now has all the rows under the column NAME filled with data
-now you can get the value of CATEGORY for each NAME with a assign activity like this
out_category_value= row(“Category”).ToString

Hope this would help you
Cheers @PacMan

Hi @Palaniyappan,

Thanks for the prompt reply. Will definitely try this out!

1 Like

sure
try and let know buddy @PacMan

HI @Palaniyappan,

I tried the above method but it seems like the assign activity is not working.
The name is not pasting into the next row as expected.