Dragon2fly / xlrd3

Other
9 stars 5 forks source link

Getting Unknown cell type 'd' in rowx=1 colx=3 when reading an xlsx file #3

Open shoaibmansoor opened 3 years ago

shoaibmansoor commented 3 years ago

I am trying to read an excel file but getting Unknown cell type exception. Code I used to read excel:

import xlrd3 as xlrd
xlrd.open_workbook(file_path)

Below is the excel file I used: Maintain_Shipment_Structure_13Nov2020.xlsx

Could someone please look into the issue? Thanks in advance.

Dragon2fly commented 3 years ago

Which software did you use to create your file? It seems that your file wasn't created by Excel. If you open the file with Excel and save it again, xlrd3 will read it normally.

Type of the error cell is 'd', which implies a date. But there is no such thing in Excel. Date in Excel is a float number of days (or fraction thereof) since 1899-12-31T00:00:00. Your cell instead is a custom type of string of date. So xlrd3 didn't know what to do with it.

I'm putting in a fix that it treat the 'd' type as string. I will release the fix later.