Keeping sharedStrings.xml

439 views
Skip to first unread message

aurelien...@gmail.com

unread,
May 16, 2019, 6:30:50 AM5/16/19
to openpyxl-users

Hello,

I’m trying to edit some cell values but saving the workbook with openpyxl gets rid of the sharedStrings.xml file. Is there a way to keep it and save the values in it? Another program I use needs it to read the data.

But maybe the right way to do it for me is to use another library like editpyxl. What do you think?

Thanks

Charlie Clark

unread,
May 16, 2019, 8:12:37 AM5/16/19
to openpyx...@googlegroups.com
sharedStrings.xml is an optional part of the specification and we dropped
support for it because it makes our implementation significantly slower.
Any application that requires it is not following the specification. I
have no idea about editpyxl but the name suggests that it is built on
openpyxl.

As a workaround you could just use an older version of openpyxl.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Aurélien Picolet

unread,
May 17, 2019, 6:12:14 AM5/17/19
to openpyx...@googlegroups.com
I tried openpyxl 2.5.14 and it worked fine, thank you.

--
You received this message because you are subscribed to a topic in the Google Groups "openpyxl-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openpyxl-users/bdnTtgXBA9c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpyxl-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openpyxl-users/op.z1vti8tt5mynk9%40fuchsia.local.
For more options, visit https://groups.google.com/d/optout.

Ivan Jiang

unread,
Dec 12, 2024, 2:43:03 AM12/12/24
to openpyxl-users
Is there a link for this specification that states sharedStrings.xml is optional?

Charlie Clark

unread,
Dec 12, 2024, 7:55:47 AM12/12/24
to openpyxl-users
On 12 Dec 2024, at 8:43, Ivan Jiang wrote:

> Is there a link for this specification that states sharedStrings.xml is
> optional?

See § 18.4

> String values may be stored directly inside spreadsheet cell elements (§18.3.1.4); however, storing the same value inside multiple cell elements can result in very large worksheet Parts, possibly resulting in performance degradation. The Shared String Table is an indexed list of string values, shared across the workbook, which allows implementations to store values only once.

In practice, better performance can generally be achieved by inlining the values in the spreadsheets themselves. The string table is probably another leftover from the old BIFF format, which was much smaller and assumed much smaller volumes of text than is now commonly the case.

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