How to read file based on the environment,

“C:\Users*W890123*\Documents\UiPath\DataBase_Connection\NASDAQ.xlsx”

so I need read file based on the environment

Thanks in advance

Hi @ManjunathReddy ,
I don’t really understand, reading files based on extension of file, file type or what?
Can you tell more to clear it
regards,

Based on environment not extension

HI,

How about the following expression?

System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("USERPROFILE"),"Documents\UiPath\DataBase_Connection\NASDAQ.xlsx")

Regards,

What is user profile here? is it System id?

You can try
Path.Combine(Environment.CurrentDirectory, folderPath.ToString)
regards,

HI,

System.Environment.GetEnvironmentVariable("USERPROFILE") returns user folder of current user such as c:\User\username

Regards,

Before documents i am having like below image

image

Hi,

How about either of the following?

System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal),"UiPath\DataBase_Connection\NASDAQ.xlsx")

OR

System.IO.Path.Combine("c:\Users",System.Environment.GetEnvironmentVariable("UserName"),"Documents\UiPath\DataBase_Connection\NASDAQ.xlsx")

Regards,

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