yangyang
yangyang

Reputation: 531

Python pd.read_excel Unsupported format, or corrupt file

Can someone tell me why do I receive this error message when I run my data pipeline? My writer script used python with

df = pd.read_excel(xls_file, sheet, header=None)

The error message was:

Message: Unsupported format, or corrupt file: Expected BOF record; found b{"error"

I am trying to understand what's going on with the data so the script would not read it.

Thank you in advance

Upvotes: 0

Views: 115

Answers (1)

AKX
AKX

Reputation: 168913

Based on

Expected BOF record; found b{"error"

it looks like what you expect to be an XLS file is actually a JSON file that represents some sort of error. You can verify my hunch by opening that file in a text editor.

I suspect an earlier part of your data pipeline doesn't e.g. check whether a remote server returns an error (e.g. resp.raise_for_status() in Requests), so you end up dumping some arbitrary data into the file.

Upvotes: 1

Related Questions