The openpyxl module has problems when writing data to a sheet if there are pivot tables in the document
Hi! I use this code to write data to an existing xls file. Generated a text dataset
from urllib.parse import urlencode
import requests
import pandas as pd
l1 = [1,2,3,4]
l2 = [1,2,3,4]
df = DataFrame({'Stimulus Time': l1, 'Reaction Time': l2})
df
w= pd.ExcelWriter('data.xlsx', mode= 'a', if_sheet_exists= 'overlay', engine= 'openpyxl')
df.to_excel(w, sheet_name= 'data', index= False)
w.save()
The data should be recorded in the data sheet, on the other sheets there are pivot tables that are built on the basis of the data sheet. If you run the code, then at the data recording stage, the code will be executed indefinitely.
But if you fill in the data sheet with terms from 50 and update the pivot tables, then the data will be recorded.
Tell me what is the problem here and how can it be solved? I didn't find any information anywhere