I am attempting to read values from an Excel file using xlrd. It has been working great on dates, numbers, and up until now text. I have a column (category) with cells containing text (the cells are formatted as text). When I print out the cell value a float is displayed instead of the text. I also printed out the ctype of the Cell object(s) to check and it is showing as Number. I've read through the documentation and tutorial of xlrd and can't seem to find why this is occurring. Could it be that my excel file is somehow messed up? Any suggestions or pointers in the right direction?
import xlrd
import datetime
workbook = xlrd.open_workbook('training.xls')
courseSheet = workbook.sheet_by_index(0)
for row in range(courseSheet.nrows):
title = courseSheet.cell_value(row, 2)
date = courseSheet.cell_value(row, 4)
date = datetime.datetime(*xlrd.xldate_as_tuple(date, workbook.datemode))
dateTuple = date.timetuple()
category = courseSheet.cell_value(row, 7)
print category
cell.ctype
of the cells in column 7?print category
printout ?