Accessing the 1st value of the array

studio

#1

Hi all,
If I comment out the Open Excel application scope, there is no error.
Modify

When I place the Open Excel Application scope, it throws me this error. I can’t figure it out. Please help.

The error should be coming from the Assign value.
image.

It always state the index bound of the array is out of range.

However, when I comment out the Open Excel, it works perfectly.


#2

Hi Poogy112,

1st comment out the Open Excel

2nd with the help of writeline activity try to find out what is the output of lModFiles(0).ToString. it might help you figure it out where is the source of the problem.

1


#3

It’s okay. I figured out the issue. UiPath ran too fast and before the file was downloaded and stored in the directory, UiPath already read what was inside the directory, causing the output to be null. Thanks for the help though.

Is there any way to pause the program or wait for the file to be added into the folder without using delay activity or file change trigger activity??


#4

Hi Bryan,

You could use a condition before Excel application scope: if System.IO.File.Exists("filePath")