xlsx和xlsm文件返回badzipfile:文件不是zip文件 [英] xlsx and xlsm files return badzipfile: file is not a zip file
问题描述
我试图同时打开一个xlsx文件和一个xlsm文件都给我相同的错误
I'm trying to open both an xlsx file and an xlsm file both give me the same error
badzipfile:文件不是zip文件
badzipfile: file is not a zip file
这是我输入的内容:
import openpyxl
wb=openpyxl.load_workbook('c:\\users\\me\\documents\\filename.xlsm', keep_vba=True)
wb2=openpyxl.load_workbook('c:\\users\\me\\documents\\filename2.xlsx')
两个load_workbook
命令都导致相同的错误.它们都存在于该位置.为什么我会收到此错误?
both load_workbook
commands result in the same error. They both exist at that location. why am I getting this error?
推荐答案
我遇到了同样的问题,然后我注意到了以下内容:
The same problem occurred to me, and then I noticed the following:
当我从文件管理器创建.xlsx文件时,通过创建.xlsx格式的新文档,我遇到了相同的错误.但是,当我使用某些电子表格软件(libreoffice-calc)创建文件时,它就可以正常工作.希望对您有所帮助.
When I created the .xlsx file from file manager, by creating new document with .xlsx format, I had the same error. But when I created the file with some spreadsheet software (libreoffice-calc) in my case, it just worked fine. I hope this may help.
这篇关于xlsx和xlsm文件返回badzipfile:文件不是zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!