Home > Back-end >  Pandas: ValueError: Worksheet index 0 is invalid, 0 worksheets found
Pandas: ValueError: Worksheet index 0 is invalid, 0 worksheets found

Time:11-13

simple problem that has me completely dumbfounded. I am trying to read an excel document with pandas but I am struck by ValueError: Worksheet index 0 is invalid, 0 worksheets found. My code snippet works well for all but one excel document linked below. Is this an issue with my excel document (which definitely has sheets when I open it in excel) or am I missing something completely obvious?

Excel Document

EDIT - Forgot the code. It is quite simply:

import pandas as pd
df = pd.read_excel(FOLDER   'omx30.xlsx')

FOLDER Is the absolute path to the folder in which the file is located.

CodePudding user response:

EDIT: with the info that you have the original .csv, re-do your cleaning and save it as a .csv from Excel; or, if you prefer, pd.read_csv the original, and do your cleaning from the CLI with pandas directly.

CodePudding user response:

It seems there indeed is a problem with my excel file. We have not been able to figure out what though. For now the path of least resistance is simply saving as a .csv in excel and using pd.read_csv to read this instead.

  • Related