Faq/Calc/How to remove a Password Protected Sheet Flag

    From The Document Foundation Wiki
    < Faq‎ | Calc


    If you came here for how to remove the password protected encryption from a .ods or .xlsx file: there's no way other than brute force try password combinations. Good luck.


    How to remove a Password Protected Sheet Flag

    There exists a protection flag that determines whether a sheet and its cells is editable or not, which also in the case of a password being assigned is more or less just a simple flag in the file format. It is possible to remove it if you know what you're doing. Backup your document first! We are not responsible if modifying your document will result in something eating your cat later or even worse.

    The stored flag of course depends on the document format.

    In an .ods zip file it is in the content.xml file in an element table:table that corresponds to the sheet in question, remove the table:protected and table:protection-key and table:protection-key-digest-algorithm attributes together with their values and freshen (!) the .ods zip with the modified file. Do not create a new zip.

    In an .xlsx zip file it is in an xl/worksheets/sheet*.xml file (numbered in sequence of the sheets in order), remove the entire <sheetProtection.../> element and freshen (!) the .xlsx zip with the modified file.

    If this is all mumbo-jumbo to you ask someone who can do it for you.


    How to remove a Password Protected Spreadsheet Structure Flag

    Very similar to the sheet protection flag there also exists a structure protection flag to prevent showing hidden and moving sheets.

    Again, backup your document!

    In an .ods zip file it is in the content.xml file in an element office:spreadsheet (that contains the table:table sheet elements), remove the table:structure-protected and table:protection-key and table:protection-key-digest-algorithm attributes together with their values and freshen (!) the .ods zip with the modified file. Do not create a new zip.

    TBD: if there is (currently Calc does not store such thing) document it for .xlsx


    Nota Bene

    NB: freshening the zip file means to use for example the command
    zip -f filename.ods content.xml
    Do not create a new zip and do not omit the -f option switch. This preserves the original order and compression algorithms of the files within the zip archive, which can be vital.

    Having read this it should now also be clear that a sheet protection flag, even with a password associated, is not a safe way to protect things. It does protect sheets and cells from being edited in a normal workflow, but by no means is a security feature.

    Again, you did backup your file before trying this, didn't you?