Why Does A 'writeonlyworksheet' Object Have No Attribute 'cell'?
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') Wh
Solution 1:
From the write-only mode docs:
In a write-only workbook, rows can only be added with
append()
. It is not possible to write (or read) cells at arbitrary locations withcell()
oriter_rows()
.
Solution 2:
Instead of doing:
wb=openpyxl.Workbook("multiplication.xlsx")
just do:
wb=openpyxl.Workbook()
then at last save with:
wb.save("multiplication.xlsx")
Post a Comment for "Why Does A 'writeonlyworksheet' Object Have No Attribute 'cell'?"