TypeError: 'Worksheet' object is not callable
来源:8-11 项目实战之结果回写
慕粉4028025
2020-12-09
handle_excel中调试excel_write_data方法时会提示worksheet对象不可调用。handle_excel文件中excel_write_data只调用了load_excel,加载了整个文件,确实没有指定sheet,这里怎么指定sheet呢?
写回答
1回答
-
慕粉4028025
提问者
2020-12-09
#coding=utf-8
import openpyxl
import sys
import os
base_path = os.getcwd()
sys.path.append(base_path)
def load_excel():
# 加载excel
open_excel = openpyxl.load_workbook(base_path+"/Case/imooc.xlsx")
return open_excel
def excel_write_data(row,clos,value):
'''
向ecxel中写入数据
'''
wb = load_excel()
wr = wb.active()
wr.cell(row,clos,value)
wb.save(base_path+"/Case/imooc.xlsx")
excel_write_data(10,1,'123')
022020-12-18
相似问题