I have an excel file (.xlsx) with 2 tabs, one with a pivot table, the other with data in a named range. I'd like to be able to programatically change the data in the data tab so that when the file is opened, the pivot table can be updated. However, when I save a file using
openpyxl, the pivot table is destroyed.
Here is the code I'm running
#!/usr/bin/env python import openpyxl as px from openpyxl import load_workbook # Open excel file filename = 'wbk1.xlsx' wb = load_workbook(filename=filename) wb.save(filename)