Search code examples
pythonxlrd

Reading xls file with Python


import xlrd
cord = xlrd.open_workbook('MT_coordenadas_todas.xls')

id = cord.sheet_by_index(0)
print id

When I run my code in terminal,I got

<xlrd.sheet.Sheet object at 0x7f897e3ecf90>

I wanted to take the first column,so what should I change in my code?


Solution

  • id is a reference to the sheet object. You need to use values = id.col_values(0) to read the values from the first column of that sheet.