HXLStandard/libhxl-python

Report merged cells from XLSX

Closed this issue · 5 comments

Report if an XLSX contains merged cells.

Requested by USAID, via Dan.

Here is the call to xlrd3 that returns the info: https://pythonhosted.org/xlrd3/sheet.html#Sheet.merged_cells

The strategy will be to create a class hxl.model.MergedCell where __str__ returns the empty string, then constants hxl.model.MERGED_CELL_LEFT, hxl.model.MERGED_CELL_UP, and hxl.model.MERGED_CELL_BOTH (also available in hxl.*), which will be the value of any empty cell that's merged from above, from the left, or both.

At first, we'll support only in Excel, but later we can add Google Sheets.

Will need to add more magic methods to the MergedCell class to support comparisons.

Reopening. It turns out that the MergedCell object will break JSON serialisation, so going to take a different approach, building it in as an option for raw input rather than downstream.