I`m using xlrd to handle some data in Excel.
I have three same number data '123' in a column.
The first cell formatted as Text, the second cell formatted as General, and the last one is same as the first.
I edited the last cell, just double clicked and didn`t change any thing. So I got the Error Check tips(the small green triangle) in the last cell: 'The number in this cell is formatted as text or preceded by an apostrophe.
I save my excel file and run my code:
excel = xlrd.open_workbook(MyExcelName)
for sheet in excel.sheets():
for i in range(sheet.nrows):
for jin range(len(sheet.row_values(i))):
value=str(sheet.row_values(i)[j])
print(value)
...
And I get this:
123.0
123.0
123
It means xlrd read number in the text format as a float.
But what puzzles me is the third cell wasn`t read as float.
How this happen? I means, its all formatted as text, xlrd would check the Error Tips? Why don`t it just check the cell format, read text as string?