Django upload excel file

78 Views Asked by At

I'm trying to load my old excel format file (xls). But I got error with empty row. How can I break loop from empty row?

def isNaN(num):
    return num != num

wb = pd.ExcelFile(file)
first_sheet = wb.sheet_names[0]
ws = wb.parse(first_sheet, header=5)

for row in ws.itertuples():
      if isNaN(row[11]):                
            break      

Error:

AttributeError: 'dict' object has no attribute 'headers'

0

There are 0 best solutions below