Type Into: Index and length must refer to a location within the string. Parameter name: length

Hello all,

I am getting errors as Type Into: Index and length must refer to a location within the string.
Parameter name: length


Can u pls tell me where I did the mistake


Thank you,


Please check if row(1) is returning any values by debugging. This usually happens if the string that you’re trying to substring is empty.

Also, are you reading the Excel file from column A or column B?

row isn’t an array. Row.Item is an array containing the columns. I assume you’re trying to get the value of the second column (index 1) so change it to…


Hello rahul,
It enters correctly but i am getting error
when i am de-bugging returning " ",
reading Column B

Preparation_File_Reading.xaml (19.0 KB)
pls find my xaml…

pls correct me where i am wrong


If you are reading from column B, row(1) must refer to items in column C and I also notice in the logs that the first row item that ends with 30000 is printed correctly.

The second row in column C is empty and the bot is unable to substring the empty value, thus the error.

You could add an empty check to identify this or maybe enter any default value, as per your requirement.

Thank you for reply,

How to avoid in empty cells … while doing substring.

If I fill something in empty cells it works fine… No error …

How to avoid this error when empty cells …


You could use an if condition with the below condition:


Inside the then part, have a log message and in the else part, have your Type Into activity.

Hi Rahul,

I have done changes as u mentioned i am confused what to fill in type into activity…
can u pls help me…

hi @tkiran - Please check the locals tab for the value where the error occurs.

Also, if possible please share the sample excel sheet after masking/removing sensitive info.

Hi guru,

ABC.xlsx (16.8 KB)
Preparation_File_Reading.xaml (19.0 KB)


Don’t use substring inside the if condition.

Put the below condition inside if:

Your Type Into can remain the same.

Hi rahul ,
Thank you so much… it is working fine :grinning:

1 Like

Hi Rahul,

One small doubt if I want to type into other columns like C, D, E then what will be the condition can u pls help me…


For null check the condition would be the same except you need to change the column index value like row(2), row(3) etc.

Also, please check the values returned for merged cells, like the second row in columns B and C.

Hi rahul,

Thank you for your great support … it is done as you mentioned it works

1 Like

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