Open Excel document that requires a password to modify

Excel has two different workbook protections that require a password. At my company most files are opened as read-only unless you supply a password.

Using the Excel application scope activity and providing it the password doesn’t seem to work. It seems like no data is passed to excel, so nothing will happen until you manually enter the password.

I’ve also tried using the “type into” activity, as well as using the “type into” activity in parallel, but nothing works and it keeps getting stuck trying to open. Is there a way to supply excel the password so that the file can be opened and editable?

Hey @Dave

May i know your Excel Package Version?

and you can give it a try with workbook read range with password in its properties.


I’m using Excel Package Version 2.0.6479.13204 - I don’t see any updates available, so I believe it’s the latest version. I’m using Enterprise Edition Studio 2017.1.6435 and Excel 2010 (32-bit)

I’m not seeing password as a field in the properties window for the workbook read range activity? See attached screenshot:

My bad… they have remove those Target option with latest update with Excel package :slight_smile:. Then it should work with excel scope.

Can you share that sample file?


dw Monthly Processing 1017.xlsx (171.4 KB)

I removed most of the tabs other than the tab named “I_Index” as it contained sensitive data. I also had to save as .xlsx as I couldn’t load a .xlsm file.

The password to modify is “test” (without quotes)

Bump - anyone have any ideas?

@Dave, this uses “Start process” instead of Excel scope, but it works for me. You’ll have to modify the path to Excel to suit your system. I would think once you get the workbook open you can go from there. Please let me know if it works for you.


Excel (163.9 KB)

1 Like

It works! Thank you for this.

Since I’m not using the excel scope activity, the only thing different that needs to be done within UiPath is that I need to ensure the excel application and workbook gets saved & closed properly, correct?

Is there a way to assign the open workbook to a workbook variable for an easy way to pass to the “Use Existing Workbook” input for an Excel Application Scope activity used elsewhere in the XAML file? I’m trying to use activities such as execute macro, but that requires to be inside of an Excel Application Scope activity

1 Like

@Dave, sorry I haven’t been able to get any farther. I’ll try again tomorrow.

Edit: Got it, I think. I used tips from this link, because I didn’t know that Excel “protection” really isn’t protection at all.

This is really uncommented, I apologize. What it does is this:
Open the protected workbook and enter the password via “Start Process”
Using only Type Into and Send Hotkey, get to the “Save As” dialog.
Using more Send Hotkeys and Type Into, remove the protection from the file.
Save it as “tempWbk.xlsx”
Close the application.

Now, Excel Application Scope → tempWbk.xlsx → set output variable to wbkVar.
Message Box to prove it’s there. Now you have an output variable to work with, and the original file is still protected.
Now, if you’re doing this from a template file, you may not even need to rename the file, but I think you’ll get the idea just watching it run.

This was actually fun - I’m glad you brought this up. I learned some things from it.

burque505 (161.9 KB)

1 Like

@Dave, as per my modus operandi I’m falling back on AutoHotkey. This is dead simple. You’ll need UiPath.Script.Activities for it.

“Run Auto Hot Key Script” loads an AHK script (about a dozen lines) that sits and waits for the Excel Application Scope to bring up the password dialog.

(I’ve discovered Excel Application Scope will not continue processing anything until that password dialog is dismissed. So the solution lay outside and before the Excel Application Scope.)

As the AHK script is basically lurking in the shadows outside the Excel Application Scope, it can fill the password dialog when it appears.

After that you can of course process the workbook as you see fit, without any of the tortured hoops that the script I posted yesterday jumps through.

Included are:

  1. SetExcelPassword.ahk;
  2. dw Monthly Processing 1017.xlsx; (I know you have it, but in case this is useful to anyone else.)
  3. AHK_Excel_Password.xaml;
  4. password.txt; (It’s still ‘test’ with no quotes)

Edit 17 Nov 2017: Re-upped archive (corrupt) and added alternate, function-style AHK script to allow dynamic change of password.

burque505 (160.1 KB)

Function version (takes arguments): (160.2 KB)

1 Like

Download and open your script, I met this error, could you please help to solve this?
Thanks in advance.

Hi @lola,
Check this will get the fix



Hi @Iola, as @balupad14 says, downloading the UiPath.Script.Activities should do it. Please let us know if it doesn’t.

Hi, Download the latest package version 1.0.6668.23727, and put it into uipath installation folder: ‘C:\Program Files (x86)\UiPath Platform\Packages’ , then restart uipath, still met same problem :disappointed_relieved::disappointed_relieved::disappointed_relieved:

Install them in the Studio package manager, I can open the script successfully, Thanks