Cannot open existing file. Error: Unknown relationship

Issue #715 resolved
dnk_k created an issue

Cannot open Excel file

File "C:\Python35\lib\site-packages\openpyxl\packaging\", line 97, in getitem raise KeyError("Unknown relationship: {0}".format(key)) KeyError: 'Unknown relationship: '

Comments (3)

  1. CharlieC

    Thanks for the report. The problem is related to a special hidden sheet created for form controls, Excel uses a hack that to do this (the sheet is not supposed to be visible):

    <sheet name="Module1" sheetId="3" state="veryHidden" r:id=""/>

    r:id is a required attribute

    I filed a bug with the OOXML WG about this. The specification has since been tightened up but they said that files with macros are effectively not covered by the specification and thus are allowed to violate it!

    Unfortunately, this file cannot be validated by the OOXML validator because the file containing the form controls is not valid XML! :-(

    The workaround is to remove the line from the workbook.xml but I'll see if we can add something to openpyxl that will do this. NB. this may mean that something may be lost from the file.

  2. Log in to comment