2

I am trying to read excel (.xlsx) file and convert it to dataframe. I used pandas.ExelFile , pandas.read_excel, openpyxl load_workbook and even io file reading methods but i am unable to read Sheet of this file. Every time i get list index out of range error or no sheet names is case of openpyxl. Also tried xlrd method.

temp_df = pd.read_excel("v2s.xlsx",  sheet_name = 0)

or

temp_df = pd.read_excel("v2s.xlsx",  sheet_name = "Sheet1")

or from openpyxl import load_workbook workbook = load_workbook(filename="v2s.xlsx",read_only = True, data_only = True) workbook.sheetnames

Link to excel file

UDevD
  • 21
  • 1
  • 2

1 Answers1

5

According to this ticket, the file is saved in a "slightly defective" format.

The user posted that he used Save As to change the type of document back to a normal Excel spreadsheet file.

Your file is this type:

Save as type

You need to save it as:

New type

Then running your code

from openpyxl import load_workbook
workbook = load_workbook(filename="v2s_0.xlsx",read_only = True, data_only = True)
print(workbook.sheetnames)

Outputs:

['Sheet1']
APhillips
  • 1,175
  • 9
  • 17