This can be done with openpyxl, I'm not sure its possible with Pandas at all. Here's how I've done it:

import openpyxl

wb = openpyxl.load_workbook('yourfile.xlsm')
sheets = wb.sheetnames
ws = wb[sheets[0]]
# Deprecation warning
# ws = wb.get_sheet_by_name('Sheet1')
print(ws.cell(row=2, column=1).hyperlink.target)

You can also use iPython, and set a variable equal to the hyperlink object:

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

then do t. and press tab to see all the options for what you can do with or access from the object.

Answer from wordsforthewise on Stack Overflow
Top answer
1 of 5
19

This can be done with openpyxl, I'm not sure its possible with Pandas at all. Here's how I've done it:

import openpyxl

wb = openpyxl.load_workbook('yourfile.xlsm')
sheets = wb.sheetnames
ws = wb[sheets[0]]
# Deprecation warning
# ws = wb.get_sheet_by_name('Sheet1')
print(ws.cell(row=2, column=1).hyperlink.target)

You can also use iPython, and set a variable equal to the hyperlink object:

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

then do t. and press tab to see all the options for what you can do with or access from the object.

2 of 5
4

Quick monkey patching, without converters or anything like this, if you would like to treat ALL cells with hyperlinks as hyperlinks, more sophisticated way, I suppose, at least be able to choose, what columns treat as hyperlinked or gather data, or save somehow both data and hyperlink in same cell at dataframe. And using converters, dunno. (BTW I played also with data_only, keep_links, did not helped, only changing read_only resulted ok, I suppose it can slow down your code speed).

P.S.: Works only with xlsx, i.e., engine is openpyxl

P.P.S.: If you reading this comment in the future and issue https://github.com/pandas-dev/pandas/issues/13439 still Open, don't forget to see changes in _convert_cell and load_workbook at pandas.io.excel._openpyxl and update them accordingly.

import pandas
from pandas.io.excel._openpyxl import OpenpyxlReader
import numpy as np
from pandas._typing import FilePathOrBuffer, Scalar


def _convert_cell(self, cell, convert_float: bool) -> Scalar:
    from openpyxl.cell.cell import TYPE_BOOL, TYPE_ERROR, TYPE_NUMERIC
    # here we adding this hyperlink support:
    if cell.hyperlink and cell.hyperlink.target:
        return cell.hyperlink.target
        # just for example, you able to return both value and hyperlink,
        # comment return above and uncomment return below
        # btw this may hurt you on parsing values, if symbols "|||" in value or hyperlink.
        # return f'{cell.value}|||{cell.hyperlink.target}'
    # here starts original code, except for "if" became "elif"
    elif cell.is_date:
        return cell.value
    elif cell.data_type == TYPE_ERROR:
        return np.nan
    elif cell.data_type == TYPE_BOOL:
        return bool(cell.value)
    elif cell.value is None:
        return ""  # compat with xlrd
    elif cell.data_type == TYPE_NUMERIC:
        # GH5394
        if convert_float:
            val = int(cell.value)
            if val == cell.value:
                return val
        else:
            return float(cell.value)

    return cell.value


def load_workbook(self, filepath_or_buffer: FilePathOrBuffer):
    from openpyxl import load_workbook
    # had to change read_only to False:
    return load_workbook(
        filepath_or_buffer, read_only=False, data_only=True, keep_links=False
    )


OpenpyxlReader._convert_cell = _convert_cell
OpenpyxlReader.load_workbook = load_workbook

And after adding this above in your python file, you will be able to call df = pandas.read_excel(input_file)

After writing all this stuff it came to me, that maybe it would be easier and cleaner just use openpyxl by itself ^_^

🌐
GitHub
github.com › pandas-dev › pandas › issues › 13439
Feature request: read_excel to support hyperlinks split into label and hyperlink · Issue #13439 · pandas-dev/pandas
June 14, 2016 - Add an argument for example named hyperlinkparser to read_excel() that offers options: "label", "hyperlink", "both" label ... just the label (this is how it is handled now) hyperlink ... just the hyperlink, drop the label split ...
Author: pandas-dev
Discussions

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
python - Retain hyperlinks in Pandas - Excel to dataframe - Stack Overflow
I was excited to try Pandas to help streamline the conversion and keep from saving the Excel sheets as HTML and then spending all day removing all the horrific MS tags. I was able to read the Excel file + sheets and then load them as a dataframe. The only problem is that it is stripping all the hyperlinks ... More on stackoverflow.com
🌐 stackoverflow.com
python - hyperlink in pandas (dataframe to excel) - Stack Overflow
Read more > Find centralized, trusted content and collaborate around the technologies you use most. Learn more about Collectives ... Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams ... I'm trying to create a excel file with ... More on stackoverflow.com
🌐 stackoverflow.com
python - how do I process an excel file with hyperlink/url in pandas? - Stack Overflow
I have an excel file that has one column filled with Hyperlinks, I read it using df = pd.read_excel() then filtered it and saved it to a new excel file with df.to_excel(). The problem is that I have now lost the clickable hyperlinks, instead, there's just the text(not a hyperlink) Can I use pandas ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-create-a-table-with-clickable-hyperlink-to-a-local-file-in-pandas
How to create a table with clickable hyperlink to a local file in Pandas? - GeeksforGeeks
It is used for heavy mathematical concepts, understanding huge data sets with the help of the GUI Graphical User Interface of MATLAB. Â In GUIs, hyperlinked text labels are f · 4 min read How to read a CSV file to a Dataframe with custom delimiter in Pandas?
Published: March 15, 2021
Find elsewhere
🌐
Reddit
reddit.com › r › AskProgramming › comments › eo94vu › excel_pandas_and_hyperlink_issue
r/AskProgramming - Excel Pandas and Hyperlink issue
January 13, 2020 - import pandas as pd df = pd.read_excel('//user/My Documents/file.xlsx') df['Report Link'] = r'\\user\Logs' + df['Report Link'] df.to_excel('file.xlsx') My main purpose is to copy over a big excel sheet that has a bunch of hyperlinks to network locations for files
🌐
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.
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.read_excel.html
pandas.read_excel — pandas 3.0.6 documentation - PyData |
Supports an option to read a single sheet or a list of sheets. ... Any valid string path is acceptable. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. A local file could be: file://localhost/path/to/table.xlsx. If you want to pass in a path object, pandas ...
🌐
Pandas
pandas.pydata.org › pandas-docs › stable › reference › api › pandas.read_excel.html
pandas.read_excel — pandas 3.0.5 documentation
December 26, 2020 - Supports an option to read a single sheet or a list of sheets. ... Any valid string path is acceptable. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. A local file could be: file://localhost/path/to/table.xlsx. If you want to pass in a path object, pandas ...
🌐
Stack Overflow
stackoverflow.com › questions › 67610652 › reading-hyperlink-target-data-using-python
excel - Reading hyperlink target data using Python - Stack Overflow
May 19, 2021 - Currently I'm using pandas module in my script but I search and see that pandas can't read hyperlink target data. I found that openpyxl module can do this, however it seems openpyxl has bugs. For example, I'm trying this code and I'm getting error. Copywb = openpyxl.load_workbook(r'X.xlsx') ws = wb['Sheet1'] hl_obj = ws.cell(row=2, column=4).hyperlink.target ... My excel file has an advantage that first column of hyperlink target cells has hyperlink name data.
🌐
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
🌐
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?

🌐
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.