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?
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:
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.
@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.
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
@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.
@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:
SetExcelPassword.ahk;
dw Monthly Processing 1017.xlsx; (I know you have it, but in case this is useful to anyone else.)
AHK_Excel_Password.xaml;
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.
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