当前位置: 代码迷 >> python >> 使用xlwings在Excel中插入图像
  详细解决方案

使用xlwings在Excel中插入图像

热度:37   发布时间:2023-06-13 14:00:51.0

我尝试使用以下命令在Mac上使用xlwings / appscript将图像插入Excel:

 Sheet('sheet1').xl_sheet.shapes.pictures.open('test.png')

但结果是使用图像代码打开Excel工作簿。 我尝试了很多扩展但没找到正确的扩展。

 xl_sheet.shapes.pictures.width
 xl_sheet.shapes.pictures.height
 xl_sheet.shapes.pictures.drop

有人知道如何处理它,以及它是否存在AppleScript与Python的文档?

现在已经发布了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

有关详细信息,请参阅 。

  相关解决方案