Openpyxl changing Display settings of PivotTable options

Issue #1317 new
Gunjan Sharma created an issue

Hi,

I have been using openpyxl pretty recently. So far, everything is pretty amazing. I have been able to write to pre-formatted excels without any issues except this tiny thing now. So, post editing the excel (with a fairly simple piece as shown below), somehow the ‘Show the Values row’ option in Display tab of PivotTable options is getting enabled. I appreciate this is not a major issue but I just wanted to understand why/how this is happening.

I am using openpyxl version 2.6.2 and a .xlsx file

workbook_name=("test.xlsx") 
wb = load_workbook(workbook_name)
ws1 = wb['data_table']
ws1.delete_rows(1, ws1.max_row)
for r in dataframe_to_rows(APR_Summary, index=False, header=True):
  ws1.append(r)
wb.save("test.xlsx")wb.close()

Please direct me to the resolution if one already exists. I wasn’t able to find anything in the searches. Thanks for help in advance.

Comments (2)

  1. CharlieC

    You’ll really need to compare the XML sources of the original and changed file. openpyxl does set some attributes for pivot tables explicitly and you can see this in the source code.

  2. Gunjan Sharma reporter

    Thank you Charlie for the prompt reply. I will look into this direction and update the issue soon. Thanks!

  3. Log in to comment