问题
重新输入sheet.还是能关联出cell属性,所以不知道问题出在哪
import os
import openpyxl
newexcelfile ="./interface.xlsx"
if os.path. exists(new_excel file):
wb = openpyxl.load_workbook(new _excel _file)
del wb["P161"]
sheet = wb.create_sheet(title="P161",index=9)
wb. save(wb. new_excel_file)
else:
wb = openpyxl .Workbook(new excel file)
sheetwb . create. sheet(title=“P161”, index=0
sheet. cell(row=1, column=1) . value = “用例ID”
报错信息
sheet.cell(row=1, column=1).value = "用例ID"
= Attribute :WriteOnlyWorksheet object has no attribute cell