open(.xls file, 'w') so that hyperlinks appear

Peter Hansen peter at engcorp.com
Mon Nov 12 01:09:52 EST 2001


Lemniscate wrote:
> 
> I made a program that takes input from a file (text file with \n
> splits).  I search a public database and find more links (using the
> urllib.urlopen function).  I want to plug these links into Excel and
> have them as functional links, but all I get is text (a Unicode
> translation thing, I assume).  

You don't say how you are getting the links into Excel?  Are
you using the win32com package and using the Excel Object Model
directly from Python?  If that's the case, you need to look
up the relevant information in the Excel docs.  I found this tidbit:

"""
Use the Add method to create a hyperlink and add it to the Hyperlinks collection. The following example creates
a new hyperlink for cell E5.

With Worksheets(1)
	.Hyperlinks.Add .Range("E5"), "http://www.gohere.com"
End With
"""

> Is there a way to modify the output so
> that they will show up as links in Excel?  I can send my code to
> anybody who wants to see it (it is big and hairy so I don't want to
> waste the space here).

Big and hairy isn't good, but can't you summarize the relevant portions
and post them?  It takes a little work, but ensures the quality
of the answers is higher...

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list