For each row in Data Table - lookup if exception exists


I have a String DataTable (can vary in amount of rows) containing 9 columns. Columns 0-5 are the result from a read range from Sheet 1 in an Excel sheet. Column 6-9 are information containing “Exception” or “No exception” concerning different categories.

What I need to do is loop through each row in the DataTable and check if any of the rows contains ann exception, and if they do: I want to copy this row (Column 0-5) to Sheet 2 in the excel sheet.

I also want to mark a column G in the first sheet as “Yes” if the row did contain an exception.

Desired result in Sheet 1:

Sheet 2:

Thank you much in advance!

You can take a loop in for each row to iterate through each column of that row take check condition for exception using if and contains function and take the required information from that row in variables and build a new datatable based on that using add datarow.
Cheers share your sheet for flow.

1 Like

Test1.xlsx (8.8 KB)

Main.xaml (13.4 KB) hope this will solve your problem.

Cheers amit,

would you explain the workflow: why does the counter start at 6? And also why condition is: while count<10 ?

my result was the following, but also the third row contained an exception (in column J) so how do i get that row into sheet 2 as well?

thanks in advance


It only checked the first row in the DT

I think the issue is that I need to loop sideways →

So with this workflow, in case there are two exceptions on the first row:

it will write the first row twice, like this:

like by default datable column index is 0 for first column so in this case you can write 0 also but i have wriiten 6 is the column from EXCEPTION values are startting
that your column is 7 less than 10 is for all coumn from 6 to 9.