Path Exists : Object reference not set to an instance of an object ERROR

Hi guys,

i need to controlling the excel file location is exist or not so i did path exist and i’m getting this error => “Object reference not set to an instance of an object.

pth

What should i do?

Thanks.

Make sure you have used the correct value in Path Property. The value you are reffering in config file does it exists?

1 Like

Hi @yigit.aybey

Check the Input → Path in the properties panel. Can you check the Config file, Just make sure there is space in-between the path.

Regards
Gokul

1 Like

the value is like this => mydata\abc.xlsx and path type is “file”

my code like this : in_Config(“ExcelDosyaKonumu”).ToString.Trim and the value is like this => mydata\abc.xlsx and path type is “file”

You can try with If activity also;

System.IO.File.Exists(Path.Combine(Config("Path").ToString+Config("Path2").ToString))

Regards
Gokul

1 Like

Hello @yigit.aybey ,

Everything looks good here, just try to print the value in message box of in_config(“PathReference”).ToString which is used in Path property.

And make sure you are using full path not the relevant path if the file is outside of your Project folder.

1 Like

instead of path exist ??

Yes, You can try like that method also @yigit.aybey

1 Like

In the beginning of the there must have C:\User_Profile\

Regards
Gokul

1 Like

my excel file is inside of the project. @rohith.prabhu but also i can try like that.

Hi @yigit.aybey

Try like this way

Environment.CurrentDirectory+"\"+in_Config(“ExcelDosyaKonumu”).ToString.Trim

Regards
Gokul

1 Like

what does it refer to? path and path 2

Hello,

Then use the below and try :
Environment.CurrentDirectory+“\”+in_Config(“ExcelreferncePath”).ToString.Trim

1 Like

Just Skip Path and Path2 . For the reference i gave the sample @yigit.aybey

System.IO.File.Exists(Path.Combine(Environment.CurrentDirectory+"\"+Config("ExcelDosyaKonumu").ToString.Trim))
1 Like

getting same error.

Can you share the error @yigit.aybey

Environment.CurrentDirectory+""+Config(“ExcelDosyaKonumu”).ToString.Trim

1 Like

i pasted to if condition but i got the same error again.

Hi @yigit.aybey

What is the variable type of the In_Config ?

1 Like

Dictionary(String,Object)