(this is an excerpt from a larger file. Only one worksheet and all the data has been deleted)
It contains 3 "real" mergeCells: A4:A6, B4:C6, D4:F5.
But it also contains three ranges (G4:L4, G5:I5, J5:L5) which behave similarly:
They look like merged cells in Excel and LibreOffice Calc
LibreOffice the ranges are treated as units when you click them (outline around the whole range, all the columns are marked, you edit the same value, no matter where you clicked)
but not completely:
In Excel, the cells of the ranges are treated as separate when you click into them (outline around individual cells, you can edit each cell individually)
Also in Excel, when I enter a value in one of the fields, the text is now centered over the remaining fields (e.g. if I enter something into K4, the text "d a v o n" is centered over G4:J4). So clearly Excel knows that these cells are somehow connected.
What is going on here and how can I detect this in openpyxl? I want my script to detect that "d a v o n" spans columns G to L and that "Arbeiter" and "Angestellte" span G to I and J to L respectively.
Peter Holzer
unread,
Feb 17, 2025, 7:13:32 AMFeb 17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openpyx...@googlegroups.com
Found it:
These cells are formatted with alignment.horizontal='centerContinuous'.
Apparently the rule is that if a cell is empty and aligned
centerContinuous and the cell to the left is also aligned
centerContinuous, then this cell is an extension of the cell to the
left.