Modifying a named range with openpyxl causing LibreOffice pivot table to stop using range

26 views Asked by At

I have a LibreOffice sheet with a pivot table with a source being a "Named range". When I modify the named range using openpyxl, the source of the pivot table becomes a "Selection" which has the old value of the named range.

I am pretty sure the Range is properly defined, because formulas that use the range are computing the proper value based on the updated definition. I am setting the name with

workbook.defined_names[name] = openpyxl.workbook.defined_name.DefinedName(name, ...)

I have also tried

workbook.defined_names[name].attr_text = ...

If I modify the Named range manually inside LibreOffice (and refresh the pivot table), all is well.

If I manually reset the source of the pivot table to be the modified named range, all is well

Thanks,

0

There are 0 answers