excel file broken after opening and saving

154 views
Skip to first unread message

Aneugene

unread,
Jul 21, 2022, 6:10:55 AM7/21/22
to openpyxl-users
I have an excel file made by hands, with images, hyperlinks and (important) images with hyperlinks. 
My steps: open file into workbook and save it with different name (I need some editing but it's pointless till output files are broken). 
Result: 
  • Open by MS Office: MS Excel shows me warning that something is broken. After restoring I see everything at same position but all hyperlinked images now point to null.
  • Opened by LibreOffice: LibreOffice Calc however doesn't throw an error, but all hyperlinked images now point to itself inside xlsx container (every link is like "xl/media/image56.png").

File itself is static, so if it is a bug that will not be fixed in a short time, it's ok to manually set every hyperlink to image again but I don't know how to do it. Is it a way to save hyperlinks on images or at least set them again automatically while editing?

Charlie Clark

unread,
Jul 21, 2022, 12:53:20 PM7/21/22
to openpyxl-users

On 21 Jul 2022, at 12:10, Aneugene wrote:

I have an excel file made by hands, with images, hyperlinks and (important)

images with hyperlinks.

My steps: open file into workbook and save it with different name (I need

some editing but it's pointless till output files are broken).

Result:

- Open by MS Office: MS Excel shows me warning that something is broken.

After restoring I see everything at same position but all hyperlinked

images now point to null.

- Opened by LibreOffice: LibreOffice Calc however doesn't throw an

error, but all hyperlinked images now point to itself inside xlsx container

(every link is like "xl/media/image56.png").

File itself is static, so if it is a bug that will not be fixed in a short

time, it's ok to manually set every hyperlink to image again but I don't

know how to do it. Is it a way to save hyperlinks on images or at least set

them again automatically while editing?

The documentation does clearly state that not everything is supported and this is particularly true for drawings and images because the relevant DrawingML is extremely complicated. That said, version 3.2 comes with significantly improved support but I have no idea when this will be released. You can work with a checkout but note that this is completely unsupported.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226

Aneugene

unread,
Jul 22, 2022, 3:50:22 AM7/22/22
to openpyxl-users
Yeah I saw documentation and saw problems with supporting images. My goal is to automate generating couple .xlsx files out of one. Simple thing but unlikely for me there are images with hyperlinks and I must save them. That's why I asked for help, images and hyperlinks are not so rare things and maybe someone found a solution to bypass this problem or there is a different library for this or someone made it with extra steps (make one .xlsx with images only by hands, generate other by this lib with empty cells instead of images and then somehow merge them or whatever). Again, I don't need to add hyperlink to image, I don't need to add external image with hyperlink, I need to just keep parts of sheets with these images as is.

Thx for answer anyways, seems there is no solution at all at this time

Reply all
Reply to author
Forward
0 new messages