import openpyxl
wb=openpyxl.Workbook("multiplication.xlsx")
wb.create_sheet()
sheet=wb.get_active_sheet()
sheet.cell(column=6, row=4).value= 5
wb.save("multiplication.xlsx")
当我尝试在单元格中写入时,我收到此错误。
Traceback (most recent call last):
File "/Users/bjg/Desktop/excel2.py", line 8, in <module>
sheet.cell(column=6, row=4).value= 5
AttributeError: 'WriteOnlyWorksheet' object has no attribute 'cell'
我想知道是否有人知道为什么会出现这种情况?
来自只写模式文档 http://openpyxl.readthedocs.io/en/default/optimized.html#write-only-mode:
在只写工作簿中,只能使用以下命令添加行append()
。不可能在任意位置写入(或读取)单元格cell()
or iter_rows()
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)