pyexcel-ods icon indicating copy to clipboard operation
pyexcel-ods copied to clipboard

Support merged cells

Open doakey3 opened this issue 8 years ago • 2 comments

Let's say I have a .ods file with merged cells like this:

+----------------------+------------+----------+----------+
| Header row, column 1 | Header 2   | Header 3 | Header 4 |
+======================+============+==========+==========+
| body row 1, column 1 | column 2   | column 3 | column 4 |
+----------------------+------------+----------+----------+
| body row 2           | Cells may span columns.          |
+----------------------+----------------------------------+
| body row 3           | Cells may  | - Table cells       |
+----------------------+ span rows. | - contain           |
| body row 4           |            | - body elements.    |
+----------------------+------------+---------------------+

Then if I do:

import pyexcel_ods

data = pyexcel_ods.get_data('example.ods')
pyexcel_ods.save_data('example.ods', data)

The resulting table loses it's merged cells and looks like this:

+----------------------+-------------------------+------------------+----------+
| Header row, column 1 | Header 2                | Header 3         | Header 4 |
+======================+=========================+==================+==========+
| body row 1, column 1 | column 2                | column 3         | column 4 |
+----------------------+-------------------------+------------------+----------+
| body row 2           | Cells may span columns. |                  |          |
+----------------------+-------------------------+------------------+----------+
| body row 3           | Cells may               | - Table cells    |          |
|                      | span rows.              | - contain        |          |
|                      |                         | - body elements. |          |
+----------------------+-------------------------+------------------+----------+
| body row 4           |                         |                  |          |
+----------------------+-------------------------+------------------+----------+

Is there any way to maintain merged cells? Thanks.

doakey3 avatar May 11 '17 17:05 doakey3

@doakey3 Did you solve your problem somehow?

Durman avatar Jul 18 '18 05:07 Durman

I needed to convert html tables into rst tables and was using pyexcel to do it until I hit the issue above. I ended up writing dashtable to do this, but I haven't found a fix for pyexcel.

doakey3 avatar Jul 18 '18 10:07 doakey3