You can do this with the XlsxWriter Worksheet write_url() method using the internal: URI. See the XlsxWriter docs on write_url().

Answer from jmcnamara on Stack Overflow
🌐
XlsxWriter
xlsxwriter.readthedocs.io › example_hyperlink.html
Example: Adding hyperlinks — XlsxWriter
This program is an example of writing hyperlinks to a worksheet. See the write_url() method for more details. ############################################################################### # # Example of how to use the XlsxWriter module to write hyperlinks # # SPDX-License-Identifier: BSD-2-Clause ...
🌐
TutorialsPoint
tutorialspoint.com › python_xlsxwriter › python_xlsxwriter_hyperlinks.htm
Python XlsxWriter - Hyperlinks
This is done by prefixing with internal: or external: the local URIs. import xlsxwriter workbook = xlsxwriter.Workbook('hello.xlsx') worksheet = workbook.add_worksheet() worksheet.write_url('A1', 'internal:Sheet2!A1', string="Link to sheet2", ...
🌐
GitHub
github.com › jmcnamara › XlsxWriter › issues › 350
write_url produces broken hyperlink · Issue #350 · jmcnamara/XlsxWriter
April 27, 2016 - Everything worked great, until i realized that some hyperlinks didn't work when there was a space in the name of a worksheet. I am using Python version 3.4 and XlsxWriter 0.8.5 (freshly pulled from github) and Excel version 2013. ... import xlsxwriter filename = 'test.xlsx' wb = xlsxwriter.Workbook(filename) ws = wb.add_worksheet('other_sheet') wb.add_worksheet('test sheet') # normally one would use an internal link here, but for this demonstration i need an external link: ws.write_url(0, 0, "external:{}#'test sheet'!A1".format(filename)) wb.close()
Author: jmcnamara
🌐
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 ...
🌐
XlsxWriter
xlsxwriter.readthedocs.io › worksheet.html
The Worksheet Class — XlsxWriter
There are two local URIs supported: internal: and external:. These are used for hyperlinks to internal worksheet references or external workbook and worksheet references: # Link to a cell on the current worksheet. worksheet.write_url('A1', 'internal:Sheet2!A1') # Link to a cell on another worksheet.
🌐
GitHub
github.com › jmcnamara › XlsxWriter › issues › 511
Issue with hyperlinking for cells containing multiple URLs · Issue #511 · jmcnamara/XlsxWriter
April 20, 2018 - You switched accounts on another tab or window. Reload to refresh your session. ... There was an error while loading. Please reload this page. ... I'm using XlsxWriter to write files that sometimes have cells containing multiple URLs. If I have a field containing for example http://example.com, http://example2.com, XlsxWriter will hyperlink the whole thing as a single link instead of hyperlinking each one individually.
Author: jmcnamara
🌐
GitHub
github.com › jmcnamara › XlsxWriter › issues › 727
Support for URLs in rich text · Issue #727 · jmcnamara/XlsxWriter
June 20, 2020 - It doesn't seem to be possible with current API. Here is code with naive hyperlink formatting that fails (Python 3.6, XlsxWriter 1.2.9): import xlsxwriter book = xlsxwriter.Workbook('hello.xlsx') sheet = book.add_worksheet() hyperlink = book.add_format({'hyperlink': True}) bold = book.add_format({'bold': True}) sheet.write_rich_string('A1', 'This is ', bold, 'bold', hyperlink, 'https://github.com' ) workbook.close() Code ends with an error: Traceback (most recent call last): File "1.py", line 11, in <module> hyperlink, 'https://github.com', File "/home/vlotorev/.local/share/virtualenvs/jira-su
Author: jmcnamara
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 58116418 › xlsxwriter-creating-hyperlink-by-referencing-value-from-another-cell
excel - xlsxwriter - Creating hyperlink by referencing value from another cell - Stack Overflow
September 26, 2019 - import xlsxwriter workbook = xlsxwriter.Workbook('file.xlsx') worksheet = workbook.add_worksheet('Hyperlinks') url_format = workbook.get_default_url_format() worksheet.write('A1', 'demo') worksheet.write_formula('A2', '=HYPERLINK("https://www.website.com/" & A1, "Testing")', url_format) workbook.close() ... Sign up to request clarification or add additional context in comments.
🌐
GitHub
github.com › jmcnamara › XlsxWriter › issues › 609
Issue with write_url when internally referencing a sheet (with spaces) in the same book · Issue #609 · jmcnamara/XlsxWriter
March 25, 2019 - The sheet names have spaces in them, so I follow the syntax guidelines of single-quoting the sheet: import xlsxwriter workbook = xlsxwriter.Workbook('hello.xlsx') worksheet = workbook.add_worksheet() call = "internal:'Summary Figure 1'!A1" worksheet.write_url(5, 0, call, url_format, string = string + str(end_year)) When I print the string 'call', I get "internal:'Summary Figure 1'!A1" out, but when I run the program and edit the hyperlink in the output xlsx file, it shows:
Author: jmcnamara
🌐
Libxlsxwriter
libxlsxwriter.github.io › hyperlinks_8c-example.html
libxlsxwriter: hyperlinks.c
* Example of writing urls/hyperlinks with the libxlsxwriter library. * * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org · * */ #include "xlsxwriter.h" int main() { /* Create a new workbook. */ lxw_workbook *workbook = workbook_new("hyperlinks.xlsx"); /* Add a worksheet.
🌐
Readthedocs
xlsxwriterlua.readthedocs.io › example_hyperlink.html
Example: Adding hyperlinks — xlsxwriter.lua Documentation
local alt_string = 'Lua home' -- Add a "tool tip" to the URL. local tip_string = 'Get the latest Lua news here.' -- Write some hyperlinks worksheet:write_url('A1', 'http://www.lua.org/', url_format) worksheet:write_url('A3', 'http://www.lua.org/', url_format, alt_string) worksheet:write_url('A5', 'http://www.lua.org/', url_format, alt_string, tip_string) worksheet:write_url('A7', 'http://www.lua.org/', red_format) worksheet:write_url('A9', 'mailto:jmcnamaracpan.org', url_format, 'Mail me') -- Write a URL that isn't a hyperlink worksheet:write_string('A11', 'http://www.lua.org/') workbook:close()
🌐
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
🌐
YouTube
youtube.com › python in office
Use Python Xlsxwriter To Create Excel Formulas And Links (Part 2) - YouTube
In Part 2 of the Xlsxwriter tutorial, we'll create Excel named range, links, and formulas. For the text version of the tutorial, check out this link: https:/...
Published: September 24, 2021
Views: 988
🌐
GitHub
github.com › jmcnamara › XlsxWriter › issues › 306
Feature Request: Add support to set the "Hyperlink base" document property · Issue #306 · jmcnamara/XlsxWriter
October 3, 2015 - Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. ... There was an error while loading. Please reload this page. ... There is a "Hyperlink base" property which can be set but is not currently supported by Xlsxwriter.
Author: jmcnamara
🌐
GitHub
github.com › jmcnamara › XlsxWriter › issues › 489
write_formula and write_url problems · Issue #489 · jmcnamara/XlsxWriter
February 4, 2018 - Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. ... There was an error while loading. Please reload this page. ... I have tried to use write_formula(row_num, col_num ,'=HYPERLINK("some URL","Some link text")', link_format).
Author: jmcnamara
🌐
GeeksforGeeks
geeksforgeeks.org › python › saving-long-urls-with-pandas-and-xlsxwriter
Saving Long URLs with Pandas and XlsxWriter - GeeksforGeeks
July 23, 2025 - This article dives into handling URLs in Excel using Python, specifically with the `pandas` library and the `XlsxWriter` engine. By the end, we'll learn how to efficiently save and format long URLs in Excel files and ensure they remain user-friendly. Excel is a powerful tool for managing and analyzing data, but working with URLs can be tricky. Long URLs often break when displayed in cells, causing formatting issues or making the spreadsheet difficult to read. Moreover, Excel might not automatically treat text as hyperlinks, requiring extra steps to keep your URLs clickable.