I wish to retrieve the Category data based on the Name from a Microsoft Excel.
Please see the screenshot below for better explanation:
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?
Welcome to UiPath community
Kindly follow the below steps that could resolve your issue
use excel application scope and pass the file path as input
use read range activity and get the output as a variable of type datatable named out_dt
use a for each row loop and pass the above obtained variable as input
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