Question

I'm trying to get hyperlinks from individual cells in an excel spreadsheet with the following code:

import win32com.client 
import win32ui

app = win32com.client.Dispatch("Excel.Application") 
app.visible = True

workbook = app.Workbooks.Open("test.xlsx")
sheet = workbook.Sheets[0]
test_cell = sheet.Range("A8").value

This prints the following:

test_cell
u'Link title'

But when I try to extract the hyperlink it did not return the link/url in string format but a 'COMObject unknown':

test_cell = sheet.Range("A8").Hyperlinks
test_cell
<COMObject <unknown>>
Was it helpful?

Solution

sheet.Range("A8").Hyperlinks.Item(1).Address
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top