How to get column values for each matching cell?

So i have an excel file in which i need to check if cell values in column equals “OK”. Then for each cell that matches, i need to get values from 2 different columns for the row the matching cell is in and put them into another excel file. I’ve managed to check if the values match the string but i’m stuck on getting the cell values for each matching cell. Can anyone help?

@mxs5052 use get row item activity(v1) inside for each

if(v1=“Ok”)
{
//Found
}
else
{
//Not Found
}

@mxs5052

First Read the Excel Sheet and store it in a datatable dta

dtb= (From p In dta.Select
        where p.Item("Column_Name1").ToString.ToUpper.Equals("OK")
       Select p).ToArray.CopyToDataTable.DefaultView.ToTable(False,"Column_Name2","Column_Name3")

Replace Column_Name1 with the Column Name where you want to check whether it contains OK.
Replace Column_Name2 and Column_Name3 with the column Names whose values you want to Extract

DataTable dtb will contain the required Output.
You Write dtb in Excel by using Write range Activity.

Regards,
Mahesh

Thank you for help guys, i’ve managed to do it with Makeshes suggestion

I have few more questions.

Ive created the dtb datatable and it has all the values i need in there. The problem now is that for each row i want to create new excel file which will contain the project name for that row, so 3 rows = 3 new files.

As you can see i used the get row item activity inside the for each row loop but the problem is only the 1st file is being created and after that i get the following error:

What could be the problem here?

I’m not entirely sure, but there could be an issue with your file name - the row item includes a backslash (): this could be confusing UIpath into thinking it’s looking for a subfolder called “Request for Approval Template - HGK”, and that there’s a file in there called “D7E6F000”. Are the backslashes necessary for the naming of your files? If not you can simply run a .replace on the string to remove the backslash.

@lordbucket thank you very much, that was exactly the problem