Borrowing heavily from this question, as I couldn't find anything on SO to link to as a duplicate...

This code will create a Hyperlink in cells A1:A9

import win32com.client

excel = r'I:\Custom_Scripts\Personal\Hyperlinks\HyperlinkTest.xlsx'

xlApp = win32com.client.Dispatch("Excel.Application")
workbook = xlApp.Workbooks.Open(excel)
worksheet = workbook.Worksheets("Sheet1") 

for xlRow in xrange(1, 10, 1):
    worksheet.Hyperlinks.Add(Anchor = worksheet.Range('A{}'.format(xlRow)),
                             Address="http://www.microsoft.com",
                             ScreenTip="Microsoft Web Site",
                             TextToDisplay="Microsoft")
workbook.Save()
workbook.Close()

And here is a link to the Microsoft Documentation for the Hyperlinks.Add() method.

Answer from SiHa on Stack Overflow
๐ŸŒ
e-iceblue
e-iceblue.com โ€บ Tutorials โ€บ Python โ€บ Spire.XLS-for-Python โ€บ Program-Guide โ€บ Link โ€บ Python-Add-Hyperlinks-to-Excel.html
Python: Add Hyperlinks to Excel
Text hyperlinks in Excel are clickable words or phrases that can direct users to different parts of the Excel file, external resources, or email addresses. The following steps explain how to add a text hyperlink to an Excel file using Spire.XLS for Python: Create a Workbook object.
๐ŸŒ
XlsxWriter
xlsxwriter.readthedocs.io โ€บ example_hyperlink.html
Example: Adding hyperlinks โ€” XlsxWriter
############################################################################### # # Example of how to use the XlsxWriter module to write hyperlinks # # SPDX-License-Identifier: BSD-2-Clause # # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org # import xlsxwriter # Create a new workbook and add a worksheet workbook = xlsxwriter.Workbook("hyperlink.xlsx") worksheet = workbook.add_worksheet("Hyperlinks") # Format the first column worksheet.set_column("A:A", 30) # Add a sample alternative link format. red_format = workbook.add_format( { "font_color": "red", "bold": 1, "underline": 1, "font_size": 12, } ) # Write some hyperlinks worksheet.write_url("A1", "http://www.python.org/") # Implicit format.
Discussions

python - adding hyperlinks in some cells openpyxl - Stack Overflow
I have to generate an excel with summary results. The results are included in a list. Some of the elements are values and some links. I managed to generate the excel with the right format but not More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - Create a hyperlink to a different Excel sheet in the same workbook - Stack Overflow
I'm using the module openpyxl for Python and am trying to create a hyperlink that will take me to a different tab in the same Excel workbook. Doing something similar to the following creates the More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - add hyperlink to excel sheet created by pandas dataframe to_excel method - Stack Overflow
I have converted a pandas DataFrame to an Excel sheet using df.to_excel. Now, I want to add hyperlinks to the values in one column. In other words, when a customer sees my excel sheet, he would b... More on stackoverflow.com
๐ŸŒ stackoverflow.com
December 13, 2017
Insert hyperlink to a local folder in Excel with Python - Stack Overflow
The piece of code reads an Excel file. This excel file holds information such as customer job numbers, customer names, sites, works description ect.. What this code will do when completed (I hope... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
EasyXLS
easyxls.com โ€บ manual โ€บ tutorials โ€บ python โ€บ excel-hyperlink-cell-file-sheet-url.html
Excel hyperlink to cell, file, sheet and URL in Python | EasyXLS Guide
Code sample Python: Create Excel file with hyperlink to cell, hyperlink to file, hyperlink to sheet or URL using EasyXLS library. XLSX, XLSM, XLSB, XLS file
๐ŸŒ
Google Groups
groups.google.com โ€บ g โ€บ python-excel โ€บ c โ€บ DQYBUletleQ
Hyperlink to a file in excel using pythonโ€
Example code below: link= 'abcd.html' sheet.write(x, y, link, format_style) This file is present on my hardrive..This file is present in the same folder in which the python code file is present... ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message ... On 14/10/2010 9:19 AM, Pman wrote: > I want to create a hyperlink in my excel sheet using python such that > when you click on that link (which is a file name (html file)), the > file automatically opens.
๐ŸŒ
Python Forum
python-forum.io โ€บ thread-20041.html
How to add hyperlink to existing Excel file
Hi, I have below the main table (both table are (csv): grp1 grp2 grp Date grp1_1 grp1_2 Date grp2_1 grp2_2 grp2_3 AHJ 20191/7/1 1/3 2/5 20191/7/1 2/5 3/3 2/6 AKL ...
Find elsewhere
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ python_xlsxwriter โ€บ python_xlsxwriter_hyperlinks.htm
Python XlsxWriter - Hyperlinks
Different types of URLs supported are http://, https://, ftp:// and mailto:. In the example below, we use these URLs. import xlsxwriter workbook = xlsxwriter.Workbook('hello.xlsx') worksheet = workbook.add_worksheet() worksheet.write_url('A1', 'https://www.tutorialspoint.com/index.htm') worksheet.write_url('A3', 'http://localhost:8080') worksheet.write_url('A5', 'ftp://www.python.org') worksheet.write_url('A7', 'mailto:dummy@abc.com') workbook.close() Run the above code and open the hello.xlsx file using Excel. We can also insert hyperlink to either another workskeet in the same workbook, or another workbook.
๐ŸŒ
Medium
medium.com โ€บ @alice.yang_10652 โ€บ add-update-extract-or-delete-hyperlinks-in-excel-with-python-168efce7f73d
Add, Update, Extract or Delete Hyperlinks in Excel with Python | by Alice Yang | Medium
June 20, 2024 - To add, update, extract, and delete hyperlinks in Excel with Python, we can use the Spire.XLS for Python library. Spire.XLS for Python is an easy-to-use and feature-rich library for creating, reading, editing, and converting Excel files within Python applications.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ trying to open a hyperlink in excel with python
r/learnpython on Reddit: Trying to open a hyperlink in excel with python
January 27, 2022 -

Hello,

I have an excel file with hyperlinks (these hyperlinks lead to a website). I want to python to open one of the hyperlinks. When I execute the script I would expect the websites to open in Microsoft edge, but instead, nothing happens. Here is my code:

import openpyxl

wb = openpyxl.load_workbook("C:\\Users\\rfog\\OneDrive\\Documents\\Python Excel\\pythontest.xlsx")

ws = wb['Sheet1']

ws.cell(row=1, column=2).hyperlink.target

Any suggestions?

๐ŸŒ
Aspose.Cells
docs.aspose.com โ€บ cells โ€บ python-net โ€บ insert-hyperlinks-to-excel
Insert Hyperlinks into Excel or OpenOffice|Documentation
A hyperlink is used to create a link between two entities. Everybody is familiar with the use of hyperlinks, especially on websites. Using Aspose.Cells for Python via .NET, developers can create different kinds of hyperlinks in Microsoft Excel files.
๐ŸŒ
Quora
quora.com โ€บ If-I-have-an-excel-file-with-a-list-of-hyperlinks-how-do-I-create-a-second-column-and-automatically-populate-it-with-the-HTML-code-no-images-nothing-but-raw-HTML-of-the-pages-in-each-hyperlink
If I have an excel file with a list of hyperlinks, how do I create a second column and automatically populate it with the HTML code (no images, nothing but raw HTML) of the pages in each hyperlink? - Quora
Answer (1 of 4): First of all thanks for asking this question because in trying to solve this I learnt something new today. The solution I have is a bit crude and may not be perfect but it does exactly what you asked here. You need 3 things :- 1. Python 2. Openpyxl Library for Python. This libra...
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ setting excel properties (hyperlink base) via python
r/learnpython on Reddit: Setting Excel properties (Hyperlink Base) via python
March 26, 2021 -

I am using python to generate a daily report, which is published as an Excel 2016 file. One column of the report will have links to .pdf files on a network share.

Attempts to hardcode the network path/file name (e.g., "T:\District\Parks\GIS\PDFs") generate a "Cannot open the specified file" error message. I have checked and the path and filenames are correct.

According to Bill Manville's answer on https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_other-mso_archive/excel-hyperlink-cannot-open-specified-file/77c6ef20-f472-453e-a88d-71e9a7a23138 , "Hyperlinks are sometimes stored as relative to the folder that contains the workbook. " This seems to be the case here. When I followed Mr. Manville's suggestion of "setting File > Properties > Summary > Hyperlink base to\\NoServer\Nofolder or some other non-existent location.", without changing anything in the hyperlinks, the hyperlinks work.

How do I access the Hyperlink Base property programmatically? Can it be done programmatically? I'll do it manually every day if necessary, but it would obviously be more consistent/faster to do it through code.

I have gone through the openpyxl documentation and have not seen anything helpful. Google/DDG searches are equally fruitless.

Thanks.

๐ŸŒ
LinkedIn
linkedin.com โ€บ posts โ€บ easyxls_how-to-add-hyperlinks-in-python-activity-7091684995731210240-3rFb
EasyXLS on LinkedIn: How to add hyperlinks in Python
July 31, 2023 - Create Excel file with hyperlink to cell, hyperlink to file, hyperlink to sheet or URL using EasyXLS library! XLSX, XLSM, XLSB, XLS file. #EasyXLS #Excelโ€ฆ
๐ŸŒ
Google Groups
groups.google.com โ€บ g โ€บ python-excel โ€บ c โ€บ ODQvunP6NsU
Hyperlinks to particular sheet and cell in a different workbook
E.g. google("excel hyperlink function examples") and click on the first result. ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message ... ๎—“Hey John, Thanks for the reply i already tried doing that, as Google specifies the formula for the hyperlink turns out to be: =HYPERLINK("[book1.xls]Sheet2!A1","CLICK HERE") which i write in my python code as: sheet.write(100,1,xlwt.Formula('HYPERLINK("[book1.xls]sheet2!