Create File in a foreign User/Directory

Hey everyone!

I have a process where I create an Excel file and it is being created in my folder (C:\Users\etc.) but I want to run the process on other computers with other users than mine. Is there a way to get the user of the computer dynamically or do I need to put in the username manually?

Thank you in advance!

1 Like

hi @RandomGuy,

Please use the below activity.

image


Mukesh

3 Likes

Thanks for your answer!
How do I include it in the Excel Application Scope? In that activity you already put in the direction/path so the Get environment folder activity comes “too late” if you know what I mean.

1 Like

So just before the excel application scope , we can put a get environment folder activity and concatenate it with the excel name and pass to excel application scope :

E.g.

Stroutput : c:/users/

ExcelPath : c:/Users/file.xlsx


Mukesh

2 Likes

@RandomGuy you can also use a Windows Environment Path variable - signified by %NAMEOFVARIABLE% - this is different from a uipath variable.

For example, typing the following in the “url” portion of windows explorer: %UserProfile%

You can substitute those Windows Environment Variables to make it work across all machines.

So in your workflow you can type in %UserProfile%/Desktop/YourExcel.xlsx which would open the excel file called YourExcel found on the current user’s desktop

1 Like

Sorry but I didn’t manage to do it.
I chose the get environment folder activity and selected desktop. then i put the excel application scope right after it and worte “C:\Users\test.xlsx” and then write cell etc.
It says that the name of the document or path does not exist.

1 Like

Before excel application scope :

Try The Following -

I got the result : C:\Users\mukes\OneDrive\Desktop\temp.xlsx

  1. Now I can use the Variable excelpath in excel application scope.


Mukesh

2 Likes

Hi @RandomGuy,

I have edited the response above , have a look.

3 Likes

I am going to try it out soon. I will respond again if I managed to do it but thank you very much in advance!