Issue in opening a file from shared path

secondexceldirec
Hi team,

I’m getting the attached issue while opening a excel from the shared path.
when i hard coded the path, the bot was able to pick the file and work on it.
Requesting your help on this.

Regards,
Naveen Kumar

@naveenkumarr

It seems that you have a space in the “BOB” folder hence the path is not fully read.

Try putting the path in 4 quotes each side.

image

Hi @GT_Ropa ,

the bot was able to read the path successfully, the problem is bot was not able to open the excel from the path,
attaching you the code


the secondfolderpath variable contains the path.

Regards,
Naveen Kumar

HI @naveenkumarr

If you need to open the excel file. Use Excel Application scope

In the properties : Visible : Tick

Regards
Gokul

@naveenkumarr

It seem’s that there is a problem with your code reading the file list. The assign activity is failing.
The index out of range means that you try to access index inside the list which is not present. Since you try with index = 0, it seems that your list is null.

Please open debug mode and write the code in the immediate panel
image

Then hit enter. Post the picture of your code.
image

1 Like

@GT_Ropa ,

okay noted, will do. also i have doubt is it because of size of variable? and do i need to increase the size of the variable ?

Regards,
Naveen Kumar

@naveenkumarr

image
The size part of this error means that you must specify index which is less than biggest index inside the collection.

Let’s say you have list like this:
{1, 2, 3, 4, 5}
The size is 5, but since index starts from 0, you have to specify index less than 5 (size of the collection) and bigger than -1 (non negative part).
-1 > index < 5

1 Like

@GT_Ropa ,

This is what i’m getting n immediate window, when i try to debug
Cannot evaluate ‘Directory.GetFiles(folderpath,“Cu *.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList(0)’ at current context.

@naveenkumarr

The error says that system do not have enough information to evaluate your expression. It may be that you tried to run it before the “folderpath” variable was assigned.
Try running the wokflow untill right before the assign action. Then use type the code again in the immediate panel.
Directory.GetFiles(folderpath,“Cu *.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList(0)

@GT_Ropa ,


no luck , this is what i’m getting

@naveenkumarr

image
It seems that you use the “folderpath” in immediate call, but in the assign you have the secondfolderpath.

Can you try both?

Directory.GetFiles(secondfolderpath,“Cu *.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList(0)

Directory.GetFiles(folderpath,“Cu *.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList