Get Files Methods in UiPath

@Palaniyappan - Hello. Would you have time to answer this issue I am encountering? “‘Directory’ is ambiguous, imported from the namespaces or types ‘Microsoft.Graph, System.IO’.”

1 Like

Yes buddy
Directory is from System.IO

@redbee

1 Like

How to remove this error message? Apologies, I’m a bit of a rookie in UiPath. Please help.

image

1 Like

Kindly mention as System.IO.Directory.GetFiles instead of Directory.GetFiles

Cheers @redbee

1 Like

Ohh, didn’t think it was just that easy. Thanks mate.

1 Like

Cheers @redbee

Hello, sorry I’m still having an issue getting the file in the network drive.

This is the Sharepoint network drive >> Test_Current (\sharepoint\rpa) (Z:)

I am trying to get the Excel files inside it but to no avail.

With this code, UiPath says Assign: Could not find a part of the path ‘Z:\Test_Current’.

System.IO.Directory.GetFiles(“Z:\Test_Current”,“Customer_“+CurrentDateMinusOne+”.xlsx”)

What could I be missing here?

After passing the Get Files, Excel file won’t open. Please help. I’m getting hopeless outta here.

image

1 Like

Hi
Is that shared drive folder path is correct
Kindly check them once

@redbee

Ohh sorry. I just figured out that the getfiles was not the issue but the Excel Scope.

The file from Directory.GetFile(GetSheetWorkingFile) is not opening in Excel Application Scope.

In the ouput message, bot is opening the excel file from different path. Not the Z path.

Please help. Huhuhu

image

May I know what was the error you were getting
In Excel application scope
@redbee

1 Like

Here it is:

Excel Application Scope: Failed opening the Excel file C:\Users\rpa\System.String. Possible reasons: the file is corrupt, the file is already used by another process or you don’t have permissions to open the file.

Excel application scope should get the file from GetSheet1WorkingFile is it?

Fine
Before excel application scope use a KILL PROCESS ACTIVITY and mention as “EXCEL” in ProcessName property
And the use excel application scope
Cheers @redbee

Which one here?

@redbee
Please share the correct workflow to detect the error this workflow is not contain anything.

Use process name as string “EXCEL” in kill process.

This will work!!!

This error raises due to wrong input path of excel file.
Please check once the path using debugging then correct it will work perfectly.

Cheers @redbee

2 Likes

If anything still not resolved please feel free to discuss with me.

Thanks & Regards,
Paras :grinning:

You were almost done
Mention as “EXCEL” between double quotes in the same ProcessName property

@redbee

1 Like

System.IO.Directory.GetFiles(“Z:\Test_Current”,“ Customer_“+CurrentDateMinusOne+” .xlsx

This returns an array.
You should assign to a string variable as
Excelfilepath= System.IO.Directory.GetFiles(“Z:\Test_Current”,“ Customer_“+CurrentDateMinusOne+” .xlsx)(0)
And pass this excelfilepath variable to your excel scope

2 Likes

Yah that could be the he reason either
Kindly mention with index position and try once
I didn’t see the expression @Sourav_Anand based on the error I was suggesting that buddy

@redbee

2 Likes

Sorry what does the (0) do on System.IO.Directory.GetFiles(“Z:\Test_Current”,“ Customer_“+CurrentDateMinusOne+” .xlsx)(0)?

Thank you so much for your inputs. Apologies as I am just starting learning UiPath :slight_smile: Cheers mate

1 Like