I have an Excel with several sheets, two of which contain pivot tables based on data from other sheets ("data sheets"). Using the openxlsx package, I'm loading the Excel into R and first removing the data sheets and then creating them again with new data. This works well and the pivots update accordingly.
However, if I apply conditional formatting to the pivots and perform the above process, then I obtain an error message when opening the new updated file (We found a problem with some content in [file]. Do you want us to try to recover as much as we can? [...]). After having done the repair, I get the message:
Repaired Records: Conditional formatting from /xl/pivotTables/pivotTable1.xml part (PivotTable view)
The conditional formatting has been removed after the repair. I have found this page which might be of use to me, but I haven't got their possible solutions to work:
https://github.com/awalker89/openxlsx/issues/387
I have also tried to construct a minimal Excel reproducing this behavior, but while the minimal Excel I produce yields the We found a problem... error, it does keep the conditional formatting once repaired.
Any ideas? Thanks in advance!