Assign: Index was outside the bounds of the array. when reaching last row of excel which is blank

Hello wonderful people,

Below i am iterating through each and every excel row on column C and trimming some values.
My issue is that when it s reaching the last row i m getting the error Assign: Index was outside the bounds of the array.

I kind of understand why it flags it but i don t understand it since that row is blank and it should stop since it s the last row.

Any ideas?

if url column is empty then split will fail with this exception
a strategy could be:

  • filter out empty rows before or
  • check with an if before splitting on empty value like String.IsNullOrEmpty(row(0).toString)
1 Like

Thank you Peter for the suggestion, i just implemented that using what you told me but also using string.IsNullOrWhiteSpace() but now what it does (or i think it does) it s going through all the rows till the bottom and i just want it to stop at the last row and if not possible,check if the row is blank and stop.


image

Not sure if reported behaviour is matching the assumed data.
So the inspection of the data by debugging and setting breakpoint would be recommendable

however also have a look on the Break Activity

Yes,absolutely, before seeing the notification here i just thought about the break activity ( lol ) , so it works,thanks1

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