I am trying to open the hyperlinks of the individual cells in excel spreadsheet.This is the code i tried
import xlrd
import logging
wb=xlrd.open_workbook("hhh.xls")
sh=wb.sheet_by_index(3)
wsname=[]
for row in range(sh.nrows):
if sh.cell_value(row,15)=="Table":
print sh.cell_value(row,15)
print sh.cell_value(row,2)
link =sh.hyperlink_map.get(row,2)
url='(No URL)' if link is None else link.url_or_path
wsname = link.textmark.split('!')[0]
logging.debug("link=%s wsname=%s" % (link.textmark, wsname))
wstable=wb.sheet_by_name(wsname)
Please help me the problem this is the error
Traceback (most recent call last): File "reading.py", line 12, in url='(No URL)' if link is None else link.url_or_path AttributeError: 'int' object has no attribute 'url_or_path'
help........
From the documentation, you need to pass in a tuple:
link = sh.hyperlink_map.get((row,2))