from openpyxl import Workbook, load_workbook
from openpyxl.drawing.image import Image
wb = Workbook()
sheet = wb.active
#设置文字图片单元格的行高列宽
column_width = 12.25
row_height = 80.10
sheet.column_dimensions[D].width = column_width #修改列D的列宽
sheet.row_dimensions[3].height = row_height #修改行3的行高
img = Image('temp.png')
newsize = (90, 90)
img.width, img.height = newsize #这两个属性分别是对应添加图片的宽高
sheet.add_image(img, 'D3') #向D3单元格内指定添加图片