1

Following is the code I'm using to extract the image stored in G7 cell:

def getImageAttachment():
    ExcelBook = openpyxl.load_workbook("F:\\MSL Automation Framework\\msl.test\\TestDataExcel.xlsx")
    sheet = ExcelBook.active
    image_loader = SheetImageLoader(sheet)
    image = image_loader.get('G7')
    test_ImageAttachment = [{sheet['G6'].value: image}]
    return test_ImageAttachment

But TypeError: object of type 'JpegImageFile' has no len() error is thrown when running the test. Screenshot is attached below: enter image description here

Below is the screenshot attached to demonstrate image stored in G7 cell: enter image description here

Please help me out. I don't want to provide image path directly to avoid hard coding and want to get the image from excel sheet.

0 Answers0