Readrange password not working for xls file

Hi Everyone,

This is my first topic so sorry if I’m not in the right place :wink:
I’m trying to open a excel file (.xls) that is password protected using readrange (not ExcelReadRange) and it fails with the following error:

Main has thrown an exception

Source: Process MUMSS file: Read range

Message: Invalid document. EncryptionInfo or EncryptedPackage stream is missing

Exception Type: InvalidDataException

System.IO.InvalidDataException: Invalid document. EncryptionInfo or EncryptedPackage stream is missing
at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Workaround I have found so far:

  • remove the password on the xls file
  • keep the password but change the format to xlsx
  • use ExcelReadRange

For reasons that are a beyond this topic, I don’t want to use ExcelReadRange, so my questions are:
Is this a bug in UiPath? Can it be fixed?

I’ll open another topic on why I dont useExcelReadRange :wink:

hi @cmathon

1.Check that UiPath.Excel.Activities package is installed ?

2.When given read range previous we need to mention the password of the file check that as well

Thanks
Ashwin S

Hi @AshwinS2 ,

Thanks for your quick reply.
I confirm that Uipath.Excel.Activities package is installed however I do not understand your second statement:
If you mean that the password as to be provided, then yes, it is provided. (if I don’t provide it I get a different error message).

hi @cmathon

Check the below post

Thanks
Ashwin S

Hi @cmathon,

Refer this link,

Regards,
Arivu

Hi @AshwinS2,
I checked the post but it doesn’t seems to be related to the issue I’m having.
Anything in particular in that post that you think may be related ?

Hi @arivu96,

I checked the link you gave me and it does work but as it doesn’t use the read range activity but instead the excel GUI, it makes things more complicated than anything else for me.narf :frowning:

However I think it’s a good idea to create a ZIP with an example so everyone can test/see what I’m trying to do.
Give me 15 minutes and I’ll update it :slight_smile:

Hi Everyone,

I created a test project to show you the issue:

  • the password of both xls and xlsx files is “test”
  • the “Working” sequence is using the XLSX file
  • the “Not Working” sequence is using the XLS file

ExcelIssue.zip (28.1 KB)

Hope this will help :slight_smile:

I’m not sure how you were getting either of them to work as-is. You are using the read range activity, but are not containing it within an excel application scope. Therefore there is no way to input the password for uipath to open the file.

I updated your workflow and just put the read range in an excel application scope and used the password “test” and everything worked perfectly.
Main.xaml (13.7 KB)

EDIT: Sorry I didn’t read the whole post as I was just linked halfway through, so I didn’t realize you didn’t want to use excel application scope. Is the reason for this because your computer the robot runs on doesn’t have Excel installed? That is the only reasonable reason I could see why that’d be unacceptable.

I don’t believe it’s possible to use the read range activity on an excel file with a password without having it contained in the excel application scope. I am getting errors for both the .xlsx and .xls files when trying to run your sample workflow.

HI @Dave,

interesting: for me xlsx file works… What error do you get for both ?

I dont want to use the excel application scope because it gets stuck randomly when it opens the files I’m using because of the links in in. This behavior seems to be a known issue. See How to handle excel pop up when opening the excel files for the details.

Edit: Also, if the excel is in “open as read-only” mode, the excel application scope doesn’t save the changes and doesn’t fail. so we don’t know that it was not saved…
we have those 2 options set on the destination excel file for business reasons and can’t remove them.

If I run the Working sequence, I get an error that the File contains corrupted data. Exception Type: FileFormatException. I tried re-downloading and got the same error. I’m assuming this is because it is trying to read the file without using Excel. However, the password is encrypting the data, so UiPath thinks it is corrupted

If I run the Not Working sequence, I get Exception Type: JsonSerializationException. The message says that ISerializable type ‘NPOI.Util.RecordFormatException’ does not have a valid constructor. I’m assuming that for whatever reason UiPath thinks this file is JSON file. Might be the structure? Not really sure…

Either way, they both opened fine when contained in an excel scope. As for the excel pop-up, I would recommend disabling that on all your robot computers and also doing parallel activities to handle it, but there are a ton of different solutions to fix it. I didn’t read through the entire thread linked, but I did see they gave some incorrect advice. You’ll want to include a parallel sequence with the Excel application scope on the left and a sequence on the right that checks for the pop-up with element exists, then use an if activity to click it if it pops up. Another alternative would be to open your excel files using powershell or invoke code and disabling links so it won’t pop-up. It is the second parameter in workbooks.open method as specified here: https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.open.aspx

Hi @Dave,

For the working sequence, is excel able to open the file?
Also, I think we are not running on the same version, this is why we have a different behavior:
I’m running on Windows 10 Pro 64b, UiPath 2018.1.3, .net 4.0.30319.42000.
What do you have? I can try to set up the same here and see if I get the same error :slight_smile:

As for the password, it is set in the readrange/options/password text box so it should not be related to this (except if you don’t have the same version :wink: )

image

For the not working sequence, again I think this may be related to the environment we are using, so if you can give me your OS/UiPath version/.net version I’ll be more than happy to test on my side :slight_smile:

Last but not least for the excel popup: the parallel sequence doesn’t work and still get stuck (seems that no one managed to make it work).
ExcelIssueV2.zip (121.3 KB)

The good news is that the link you gave me is very useful and I’ll try to implement it.

Interesting. Didn’t realize the non-excel read range activity ever had the option for password. I’m using the UiPath.Excel.Activities package version 2.0.6526.16321 and the newest version is now 2.3.6682.26635 so maybe that’s it? I think read range is part of the excel activity pack & all other activities are up to date except database and mail activities which aren’t related.

readrange

I’m running on a windows 7 64-bit UiPath 2018.1.2 and the same .net as you. I wouldnt think the OS has anything to do with it, but it’s definitely possible.

HI @Dave,
I downloaded UiPath.Excel.Activities package version 2.0.6526.16321 and confirm that the options are different and that it doesn’t work in both cases.

Can you test with the latest version ?
(I’m still thinking its’ a bug in the read range :slight_smile: )