Skip to content Skip to sidebar Skip to footer

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 with cell() or iter_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'?"