[Python] openpyxl pillow disappearing image fix not working

Discussão em 'Python' iniciado por Stack, Junho 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am modifying an excel file with openpyxl. After saving the modified file, any images (pasted screenshots) in the excel file are lost. Disappearing images with openpyxl is a known issue. See the following SO topics:

    Images dissapear in excel documents when copying them with python

    Image errors in openpyxl

    These threads advise to pip install pillow which has solved the issue for multiple users. I have tried that but it doesnt fix the issue for me. I checked that both openpyxl (v 3.1.5) and pillow (v 10.1.0) are up to date. I'm using python 3.11.3. I also installed both packages in a virtual environment to make sure that openpyxl should be able to find pillow.

    I have imported pillow in the script, but Im not sure if this is necessary. Im not actually doing anything with it.

    from openpyxl import load_workbook
    import PIL


    Does anyone know what else I can do to make the pillow fix work?

    Continue reading...

Compartilhe esta Página