Excel Passwords

Apologies if this is a duplicate but I couldn’t seem to find an answer.

I have run into problems when getting UIPath to access password protected documents. My current project required me to open a password protected Excel sheet, but each approach I have tried has yielded no results.

This is what I have tried so far;

  • Enter the password into the Password property of Excel Application Scope.

  • Enter the text once the password box appears.

  • Click within the password field once it appears and type the password.

  • Record the steps required to focus on the password field and enter the password.

Any help would be greatly appreciated! :slight_smile:

Hello!

What error are you getting when you try to open the file using the Password property of Excel Application Scope?

Regards,

Hi Lucas, this is what I get, collapsed to save space.

[details=Error Message]Main has thrown an exception

Message: Exception from HRESULT: 0x800AC472

Source: Excel application scope

Exception Type: ExcelException

UiPath.Excel.ExcelException: Exception from HRESULT: 0x800AC472 —> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at UiPath.Excel.WorkbookApplication…ctor(String workbookPath, String password, Boolean visible, Boolean createNew)
— End of inner exception stack trace —
at UiPath.Excel.WorkbookApplication…ctor(String workbookPath, String password, Boolean visible, Boolean createNew)
at UiPath.Excel.Activities.ExcelApplicationScope.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)[/details]

Have you tried to use the Read Range of Workbook Activity instead?

Screenshot of Activity

In the Password Property you type the password like the other one.

Regards,

I hadn’t tried that, but doing so offers this error and I’m not sure it would be fit for purpose in my case.

[details=Error Message]Main has thrown an exception

Message: Part is not a compound document

Source: Read range

Exception Type: InvalidDataException

System.IO.InvalidDataException: Part is not a compound document
at OfficeOpenXml.Utils.CompoundDocument.Read(ILockBytes lb)
at OfficeOpenXml.Utils.CompoundDocument.Read(Byte doc)
at OfficeOpenXml.Utils.CompoundDocument.Read(FileInfo fi)
at OfficeOpenXml.Encryption.EncryptedPackageHandler.DecryptPackage(FileInfo fi, ExcelEncryption encryption)
at OfficeOpenXml.ExcelPackage.ConstructNewFile(String password)
at OfficeOpenXml.ExcelPackage…ctor(FileInfo newFile, String password)
at UiPath.Excel.WorkbookFile…ctor(String workbookPath, String password, Boolean createNew)
at UiPath.Excel.Activities.WorkbookActivity`1.BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)[/details]

I have tried to use this “Password” property of Excel Scope, and also the “Password” property under the Workbook activities. Both of them weren’t able to unprotect the excel file.

I made my own custom activity just to unprotect the excel file.

Here is a protected dummy excel file to simulate it.
dummy.xlsx (12.5 KB)
The password is “uipath” (lower case).

How to open the file in UiPath?

1 Like

Hey @Thiago :slight_smile:

Once again here you have to use “Read Range” activity of workbook.It will work for you. for me it is working :slight_smile:

@badita @Gabriel_Tatu @adrian Have to check why Excel application scope is not communicating well with this scanerio. Faced some issues earlier as well. it is returning UI pop up to again enter the password.

Please update on this :slight_smile:

For Reference @Thiago : excel_password.xaml (5.4 KB)

Regards…!!
Aksh

1 Like

there are no known issues on this topic, it works as expected.
now, i do have some questions for you:
-have you tried with other xlsx file? only this one does not work?
-the password is for the entire document, right?
-what excel version do you have installed on the test machine?
-can you send us the test file for us to try?
thank you.

@aksh1yadav You are correct! The “ReadRange” from workbook activity works fine. (Maybe it was my old version of Studio).

Just the Excel Scope is not handling the protected file.

We’ve had this here once or twice, nothing I’ve found has ever successfully opened a spreadsheet post Excel 2010. if the password is any longer than 4 characters and more than just a dictionary word, good luck, I hope you have a patient attitude, because it can take weeks of brute force dictionary attacking, even utilising some dodgy software that can use a high end GPU for raw number crunching.

Id suggest if its not ultimately business critical, slap the user and tell them you’ll learn next time to NOT forget it.

Brutal but necessary, you really dont want to be pulled into this kind of task, its painful.

1 Like