Python3 openpyxl doesn't preserve superscript and subscript

Hello there.

I got the issue on subject.

Assuming to have an xlsx file with superscript and/or subscript text already present into some cells, as I save the file following any elaboration by means Python 3 scripts, superscript and subscript are shown as “normal” text.

For the sake of clarity, my Python script just populate some xlsx cells with “normal” text; the script is not supposed to inserd superscript or subscript: such format is already present into the xlsx.

Thank you ever so much.

I think that the the Excel spreadsheet uses formatting for superscript and subscript and not unicode characters. This means that Python has no way of determining that and will treat the text as text ignoring the formatting.

I was going to say this. Both Perl and Python modules get, I believe, only the plain text in a cell, not the formatted text.

And in Excel, some characters in a cell can have different formatting than other characters. I don’t know how to do it myself though but I’ve seen it occasionally.