Eirik
Eirik

Reputation: 77

File is not a zip file

I try to open a file with openpyxl but only get the error:

raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

A simple code example:

from openpyxl import load_workbook

wb = load_workbook('path.xlsx')

Context: I am trying to open an existing excel file, edit the file and then save it. Until now I am able to only read the file with pandas.read_excel(path.xlsx).

Upvotes: 1

Views: 12253

Answers (1)

Eirik
Eirik

Reputation: 77

The excel files were in read-only mode. I saved the file as a new file and load_workbook worked.

Upvotes: 3

Related Questions