Range issue in for each activity

Man 3 posts in 3 days I really don’t know what I’m doing lol

This one is probably an easier fix, but I can’t seem to figure out the issue.

I have a for each row looping through a data table generated from a read range directly above it. The range I’m reading is only one column so I put in for the range “B:B” This is what I was told would read the entire B column no matter the amount of rows. My only issue is that when the last row with an item is reached, my for each activity iterates once more and tries to look for a link in an empty cell and the whole workflow stops there.

I have tried to replace the range with this
“B2:B” + dt.Rows.Count.ToString but UiPath throws an error message saying that specified range doesn’t exist.

I even tried “B2” + “:” + “B” + dt.Rows.Count.ToString and the same error was thrown.

Any help is appreciated, thanks.

@Kriptiko

First you have to use Read Range Activity and Specify range as “” and will give you output as dataTable and say dt.

And then use one more Read Range Activity and Specify range like this:

"B2:B"+dt.Rows.Count.Tostring

Are you doing this way or not ?

Oh my god you’re totally right!

I just now figured it out that the table won’t exist until I read it so I can’t use the dt name in the read range that gets it!

Thank you.

1 Like

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