【问题标题】:ValueError: Cell k2 doesn't contain an imageValueError:单元格 k2 不包含图像
【发布时间】:2022-12-11 08:43:56
【问题描述】:

我被这个关于 SheetImageLoader 的 python 代码困住了。错误消息说我引用的单元格中没有图像,但该单元格中有图像。

from openpyxl_image_loader import SheetImageLoader
import openpyxl

#ADD PICTURE TO PICBOX(TOPLEVEL)
def pic_upload():

    excel_path = ('DData.xlsx')
    file =openpyxl.load_workbook(excel_path)
    sheet=file['Sheet1']

    image_loader = SheetImageLoader(sheet)           
    picget = image_loader.get('k2')
    picget.show

这是我得到的错误:

raise ValueError("Cell {} doesn't contain an image".format(cell))
ValueError: Cell k2 doesn't contain an image

【问题讨论】:

  • 我相信你应该指向“K2”(用大写的“K”而不是小写的“k”)
  • 不敢相信它那么容易。谢谢它工作完美
  • Openpyxl 本身在坐标方面不区分大小写。我建议提交图像加载程序库的错误。

标签: python excel


【解决方案1】:

我有同样的问题,我已经将我的图表粘贴到单元格 A1 中,但它不起作用,我需要你的帮助。
我图表的尺寸在 # A1:H25 sheet = pxl doc['情节']

# calling the image_loader
image_loader = SheetImageLoader(sheet)


image = image_loader.get('A1')

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-01-19
  • 1970-01-01
  • 1970-01-01
  • 2019-06-16
  • 1970-01-01
  • 1970-01-01
  • 2018-08-08
相关资源
最近更新 更多