Hi. When I try to list the images that are inside a worksheet, it returns back the same id and path for each image. See code snippet below. I am using the latest package versions openpyxl==3.1.2 and pillow==9.5.0. The installed Microsoft Excel is product Microsoft 365 Apps for Enterprise, version 2301.
from openpyxl import load_workbook
from openpyxl.workbook.workbook import Workbook
from openpyxl.worksheet.worksheet import Worksheet
path_to_wb = r"test_python_images.xlsx"
wb: Workbook = load_workbook(filename=path_to_wb)
ws: Worksheet = wb.worksheets[0]
for image in ws._images:
print("_id:{}, img.path:{}".format(image._id, image.path))
This prints the below lines. The images in the worksheet are however really different. After extracting the xlsx-archive I find the images in directory /xl/media/, but then called image1 and image2.
The second images (image2) was added through the ws.add_image-method. This method did add the image correctly. However, as I see now, after adding and saving the _images-list does not display the correct images.
Hi. When I try to list the images that are inside a worksheet, it returns back the same id and path for each image. See code snippet below. I am using the latest package versions openpyxl==3.1.2 and pillow==9.5.0. The installed Microsoft Excel is product Microsoft 365 Apps for Enterprise, version 2301.
This prints the below lines. The images in the worksheet are however really different. After extracting the xlsx-archive I find the images in directory /xl/media/, but then called image1 and image2.
The second images (image2) was added through the ws.add_image-method. This method did add the image correctly. However, as I see now, after adding and saving the _images-list does not display the correct images.