-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I open .ods file which contains 3 sheets and trying to add some values on first sheet.
Third sheet contains merged cells.
When I save file merged cells are broken and I have to merge them again.
I user this code:
currRow = 2 # table has header!
try:
docsrc = oo.Calc(opendoc=srcfile)
docsrc.set_sheet_index(0)
(cols, rows) = docsrc.get_sheet_dimensions()
docdst = oo.Calc(opendoc=out_file)
docdst.set_sheet_index(0)
for i in range(2, rows + 1):
if type(docsrc.get_cell_value(1, i)) != type(None):
docdst.set_cell_value(1, currRow, 'string', docsrc.get_cell_value(1, i)[1])
currRow += 1
docdst.save(out_file)
except Exception as e:
print(e)
Metadata
Metadata
Assignees
Labels
No labels