databaker
databaker copied to clipboard
Think of cleverer way of doing split headers
e.g. In ashe, where it has one header cell split into three cells in Excel.
This is current code in recipe, which is horrid: https://github.com/scraperwiki/databaker/commit/6db4f5c379b1eb3e8eb5b18bf4b9cc43f21bb102
This could be done by running this function to repeat the contents of multiple width cells into each cell
def FixMultipleCellsHeading(tab):
hh = tab.excel_ref("C6:P9").is_not_whitespace()
for cc in hh:
val = cc.value
ch = set(cc.children().unordered_cells)
xwidth = len(set(c.x for c in ch))
ywidth = len(set(c.y for c in ch))
if ywidth == 1:
for c in ch:
c.value = val
elif xwidth == 1:
bottomcell = max(ch, key=lambda X:X.y)
for c in ch:
c.value = ''
bottomcell.value = val