我是编程新手。 我正在学习用python语言编写。我目前正试图将现有的字典放入一个新的excel文件中。我有一种感觉,因为我有一本字典可能是问题? 我使用的是openpyxl。openpyxl的问题:试图将字典插入新的excel文件
每当我尝试插入字典时,都会收到一条错误消息(AttributeError:'WriteOnlyWorksheet'对象没有属性'单元格')。不过,我可以写一个没有问题的简单单元格。 这是当试图填充大量数据到列中,我得到的错误。
#Writing a new excel file with key information
print("Would you like to create a new excel document?")
b_input = input("Type: 'Y' or 'N' -> ").lower()
if b_input == "y":
wb = Workbook(write_only=True)
ws = wb.create_sheet()
print("I can only put in the contract status and serial numbers together in a file.")
c_input = input("Would you like to do that? Type: 'Y' or 'N' -> ")
if c_input == 'y':
ws.cell(row=r, column=1).value = excel_info
wb.save('new_test_book.xlsx')
我没有,我会看看! 编辑:对象没有属性写入 :P –