import xlwings as xw
app=xw.App()
wb=app.books.open(r'C:\Users\Administrator\Desktop\2.xlsx')
sht=wb.sheets[0]'''
add(image, link_to_file=False, save_with_document=True, left=0, top=0,
width=None, height=None, name=None, update=False, scale=1)
image 文件地址
left 距离左边距离
top 距离上边距离
width 宽
height 高
name 图片名字 默认‘Picture 1’
update (bool, default False) – Replace an existing picture with the same name. Requires name to be set
'''
sht.pictures.add(r'C:\Users\Administrator\Desktop\1.jpg',link_to_file=True,left=60,top=60)
sht.pictures.add(r'C:\Users\Administrator\Desktop\2.jpeg')print(sht.pictures[0].height)print(sht.pictures[0].left)print(sht.range('a1').width)# sht.pictures[0].left=sht.range('a1').width# sht.pictures[0].width=sht.range('a1').width# sht.pictures[0].top=0# sht.pictures[0].height=sht.range('a1').height# print(sht.pictures)# sht.pictures[1].left=sht.range('a1').width*2