Accessing hyperlink targets if read_only=True

32 views
Skip to first unread message

Jason Atkins

unread,
May 6, 2022, 5:59:43 AM5/6/22
to openpyxl-users
Unfortunately load_workbook in standard r+w mode is too slow when loading some documents I am dealing with. So I tried to use the read-only mode instead.

However, the ReadOnlyCell class doesn't appear to provide any access to the `cell.hyperlink` properties that are available with the Cell class used in r+w mode.

Does anyone know:
1. If this functionality is likely to be added to ReadOnlyCell in future releases?
2. How to get hold of the hyperlink target information in read-only mode with the current implementation?

Thanks


Charlie Clark

unread,
May 8, 2022, 6:50:27 AM5/8/22
to openpyxl-users
On 6 May 2022, at 11:59, Jason Atkins wrote:

> Unfortunately load_workbook in standard r+w mode is too slow when loading
>
> some documents I am dealing with. So I tried to use the read-only mode
>
> instead.
>
> However, the ReadOnlyCell class doesn't appear to provide any access to the
>
> `cell.hyperlink` properties that are available with the Cell class used in
>
> r+w mode.
>
> Does anyone know:
>
> 1. If this functionality is likely to be added to ReadOnlyCell in future
>
> releases?

No, it won't

> 2. How to get hold of the hyperlink target information in read-only mode
>
> with the current implementation?

You'll have to use the parser directly for this. The problem with a lot things in worksheets is that they are stored after all the cells. This makes it impossible to expose them in cell objects impossible without reading all the cells, largely negating the advantage of read-only mode.

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
Reply all
Reply to author
Forward
0 new messages