Can not open password encrypted CALC/XLS file

I have opened a password encrypted XLS file (Excel 2016) with Libre Office 5.3. Opening is no problem. After some changes I stored the file in Excel 1997-2003 format. When I try to open the file again with Libre Office, a password is requested, but when entering the correct password from the original XLS file I get the message “Password is not correct”. As consequence, I can not open the fle anymore, neither with Libre Office nor with Excel.

Any hints?

That’s a bug in LO. It is fixed in 5.4 (master), but I cannot check atm if it is fixed in coming 5.3.1.

Actually, the file isn’t protected anymore. It just contains empty data that must not be there, and that makes both LO and Excel handle it as encrypted.

There is a method to restore the file. You need to edit the file with hex editor, though. Disclaimer: the following is only tested once with a test file sample, and may be inaccurate. I don’t take any responsibility wrt correctness of following recommendations.

I used two free tools in my test, both of them can be used without installation:

  1. Hex Edit:
  2. SS Viewer: MiTeC Homepage

First, you need to backup your file, and always have its safe copy.

  1. Open the file with with SS Viewer, and right-click on Workbook stream in left tree. Save stream to an external file.
  2. Then open the saved stream file with Hex Edit and go to offset 0x14 - it should start with 2F 00.
  3. Now select to offset 0x4E (not including the E1 00 value) - the selection must be 58 bytes long, start with 2F 00, and end with 00 00 - and delete selection.
  4. Now close the Hex Edit and return to SS Viewer, right-click on the Workbook stream again, and choose to load stream from file. Accept default encoder, and choose the edited stream file.

After the procedure completed, the file should become readable again.

Sounds complicated (I have done hex editing of documents for forensics). Before going there, may just download the latest DEV version of LO. I encountered the same thing when I was toying with (not sure of the exact build). I saved a CALC file in ODS format and encountered the problem when I used the production version of LO distributed by Ubuntu (5.1.2 I think). As noted elsewhere, this is peculiar to CALC. Did not encounter this problem with DOCX or ODT.

Just gave it a shot. My CALC file has a totally different layout. The ranges you specified only cover the filetype designation.

The problem discussed in this topic is only related to XLS format. If you encounter something similar with ODS, then it is definitely different issue, which deserves its own topic, and a bug report.

Any chance to open the file? Was my only copy, and now I can no longer access the changes I made.