How to dynamically read a excel range in a for each row loop?

I have a step in my automation that pulls a range from a excel workbook.

i then feed this dt into a for each row loop that pulls certain cell data from each row.

the only problem is it’ll read the row item data regardless of if there is data in the cell or not.

how can i get the for each loop to skip rows that don’t have any data in them?

Thanks

we can use a if condition inside the for each row loop and mention like this
String.IsNullOrEmpty(row(“columnname”).ToString)
this will validate whether that row and the column has null value or not and if it has it will go to THEN part of IF condition where we can keep our process to continue with
OR
even before using this for each row loop we can use a assign activity like this
yourdatatablename = yourdatatablename.Select("[Columnname] <> ‘’ ").CopyToDatatable()

which will give us only the rows from datatable which doesnt have any null value along the column name that we mention

hope this would help you
kindly try this and let know for any queries or clarification
Cheers @JoshBurke

Hi,

u can use IF inside the for each row and:

If String.isNullorEmpy(YourString)
In → Then (Leave Empty) = Will do nothing and pass
In → Else you can for exemple invoke another workflow file or what ever you whant

Hi @JoshBurke

Kindly check this post.

or

Regads,
Sasikumar K

Just testedyour first solution Palaniyappan and it works brilliantly.

Thank you all for your contribution.

J

1 Like

Cheers @JoshBurke

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.