I try to using pandas and openpyxl to write new data to existing excel(xlsx) file to avoid overwritten old data. Here is the reference link. How to write to an existing excel file without overwriting data (using pandas)? I keep getting zipfile.BadZipFile: File is not a zip file error, I googled it, someone said it was because I did not save the file, someone said it was due to the wrong format or the xlsx file. To rule out those possible cause, I just write the simple code like below with simple xlsx file.
writer = pd.ExcelWriter('testfile.xlsx', engine='openpyxl')
writer.book = load_workbook('testfile.xlsx')
writer.save()
xlsx file looks like below A B C aa bb cc But I still get the same error code. Any suggestion on how to resolve it?