使用 openpyxl 库加载 .xlsx 文件时出错

Error meanwhile loading an .xlsx file with openpyxl library

下午好,

几个星期以来,我在加载受保护的 .xlsx 文件时遇到问题,其中一个 sheet 受密码保护。

workbook = openpyxl.load_workbook("myFile.xlsx")

如果我从密码 openpyxl 中释放 sheet 工作正常,如果我输入密码我会收到此错误:

"Excel opening errorFile is not a zip file"

我在网上看到,最近 Microsoft 更改了 .xlsx 格式的内容,但仅此而已。 谢谢

基于this issue in the openpyxl bug tracker,不支持受密码保护的文件。

– Password protection is currently not supported.

– Will this ever be supported?

– no, because it's proprietary MS code not covered by the OOXML specification.