使用xlwings在Excel中插入图像
我尝试使用以下命令在Mac上使用xlwings / appscript将图像插入到Excel中:
Sheet('sheet1').xl_sheet.shapes.pictures.open('test.png')
但结果是用图像代码打开Excel工作簿。 我尝试了很多扩展,但没有find正确的。
xl_sheet.shapes.pictures.width xl_sheet.shapes.pictures.height xl_sheet.shapes.pictures.drop
有没有人有任何想法如何处理它,如果它存在与Python的AppleScript的文档?
现在已经发布了xlwings v0.5.0:
例:
import xlwings as xw pic = xw.Picture(1, 'picture_name') # To manipulate an existing picture pic = xw.Picture.add('path/to/picture.jpg', sheet=1) # add a new one
有关详细信息,请参阅文档 。