I want to add the Data which is saved inside of a Pandas Dataframe to an existing ExcelSheet. I have seen a solution which adds the data to a new sheet in the excel file, but i need all the Data in one ExcelSheet so it just needs to add a new row and saves the data in the new row.
This Error accurs when I try the Solution with the ExcelWriter: KeyError: "There is no item named 'xl/sharedStrings.xml' in the archive"' when trying to open Excel
Code:
def render(app: Dash) -> html.Div:
@app.callback(
Output(ids.ANSWER_OUTPUT, "children"),
Input(ids.BUTTON, "n_clicks"),
State(ids.QUESTION_1, "value"),
...
State(ids.DATE_PICKER_SINGLE, "date"),
)
def collect(
n_clicks,
answer_1_value,
...
date_picker_date,
):
dataframe = [
answer_1_value,
...
date_picker_date,
]
df = pd.DataFrame(dataframe).T
df.to_excel("output.xlsx", header=False)
if n_clicks is not None:
return df
What do I need to add as Code in mine so it adds to the existing file? Thx in advance