I am trying to get the hyperlinks URL of elements in the 2nd column of an Excel sheet using xlrd. When using:
book = open_workbook('mypath', formatting_info=True)
sheet = book.sheet_by_index(0)
r_sheet = book.sheet_by_index(0)
wb = copy(book)
w_sheet = wb.get_sheet(0)
for row_index in range(1, sheet.nrows):
URL = sheet.hyperlink_map.get((row_index, 1))
print URL
I get:
<xlrd.sheet.Hyperlink object at 0x0000000002D81898>
<xlrd.sheet.Hyperlink object at 0x0000000002D819E8>
<xlrd.sheet.Hyperlink object at 0x0000000002D81DA0>
What do I have to add to my code to get URL formatted in a string format and not an xlrd.sheet.Hyperlink object so they can be later used in the code? I am looking to get the actual URL that I see when highlighting the elements of the first column in Excel, so something like http://www.mywebpage.com