我是編程新手。 我正在學習用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 –