使用xlwings

时间:2015-10-19 19:50:19

标签: python excel applescript xlwings

我尝试使用以下命令在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的文档?

1 个答案:

答案 0 :(得分:3)

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

有关详细信息,请参阅docs