How to resove error of : Assign : Index was outside the bounds of the array



Dear all,

I have a question that when I tried to assign DataRow value into variables (GenericValue),
I got below error message…

Assign : Index was outside the bounds of the array.

How can I fix this? sorry for vague question but with my capacity it is the best I could describe in detail…


@Kn.opp this error occurs due to more element in the specified array size


Hi Kn.opp,

to give a bit more detail this error occurs when you are trying to access an index outside of the current bounds of the array.

e.g. you have an array of 5 items. (array {1,2,3,4,5}) if you try to get the item from index 10 (array(10)) you will get this error as there is actually only 5 indexes (the max being 4 as arrays start at 0).

Could you give more info on how you are assigning your data row into variables and we may be able to get you a fix.


Dear jakelewis18, indra

Thank you very much for your help here…!
I’ve tried assigin data row as attached… I hope this limited screenshot would be sufficient for your advise…

Thank you very much…





@Kn.opp, There might be a chance of returning a empty array of datarow (arrDataRowOfCsv3) after filtering. U are accessing an empty array with some index greater than zero, it returns this error.

Solution : Check the array count before you access it through index !

Dominic :slight_smile:


Dear 599712

Thank you very much, it was the case. I could resolve the select and assign issue.

But just wondering if I could ask other question…

When I tried to assng value, I got “Exception has been thrown by the target of an invocation” error as screen shot.
Just wondering how could I resolve this issue?




Try :
dataRowForNewDt(“Column1”) = “CompanyinCSV”



i need to paste the values from the data table based on the condition that if the cell is empty i need to paste it.After pasting all the values it is throwing an exception (i.e) index out of range exception.As am new to uipath,how to check whether the values are there in the input data table.if the value is there in collection it should go and paste or else it should break.Help me out of this