python-3.x - Openpyxl 2.5.11 版本问题
问题描述
我昨天用 Openpyxl 库更新到 2.5.11 版。现在,当我只是打开一个 excel 工作簿(它是一个没有宏的 xlsx 文件)时,我收到以下奇怪的错误消息,我昨天在更新库之前打开完全相同的文件时没有:代码:
tips = r"NTipsPerf6b.xlsm"
wb = openpyxl.load_workbook(tips)
这是回溯:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-16-980c37a8c9f7> in <module>()
----> 1 wb = openpyxl.load_workbook(tips)
C:\ProgramData\Anaconda3\lib\site-packages\openpyxl\reader\excel.py in load_workbook(filename, read_only, keep_vba, data_only, guess_types, keep_links)
291 ws._rels = [] # reset
292
--> 293 parser.assign_names()
294
295 #wb._differential_styles.styles = [] # tables may depened upon dxf
C:\ProgramData\Anaconda3\lib\site-packages\openpyxl\packaging\workbook.py in assign_names(self)
104 reserved = defn.is_reserved
105 if reserved in ("Print_Titles", "Print_Area"):
--> 106 sheet = self.wb._sheets[defn.localSheetId]
107 if reserved == "Print_Titles":
108 rows, cols = _unpack_print_titles(defn)
IndexError: list index out of range
如果有人对如何解决它有任何线索,将不胜感激。谢谢
解决方案
推荐阅读
- python - 在python中将一列附加到现有的csv文件
- json - React Native 下载多个 JSON 并合并
- r-markdown - Rmarkdown 生成双倍行距目录
- android - DragShadowBuilder 在 Android 11 中不工作
- javascript - 我正在编写一个javascript函数来返回数组中任何给定数字的斐波那契
- node.js - 从另一个文件夹映射访问
- java - 用于 consumerBatchEnabled 侦听器的 Rabbitmq 单元测试
- python - shutil 移动基于 csv 文件名
- javascript - 如何使用 jest.spyOn 和 React 测试库测试 React 功能组件中的功能
- ansible - Ansible playbook 检查与 Windows 主机的连接并报告状态