IRONSOFTWAREHOME

How to Create Hyperlinks in Excel with C#

Curtis Chau
Curtis Chau
Updated: August 2, 2026

IronXL enables C# developers to create various hyperlinks in Excel cells including URLs, file paths, email addresses, and cell references without using Interop, simplifying the process of adding interactive navigation to spreadsheets.

Excel hyperlinks provide clickable references to locations within the workbook, different files, web pages, or email addresses. They enhance navigation, allowing quick access to related information and external resources. Hyperlinks create interactive and user-friendly spreadsheets, facilitating easy access to additional data or external content.

IronXL enables the creation of hyperlinks for URLs, opening external files from both local and FTP (File Transfer Protocol) file systems, email addresses, cell addresses, and defined name cells without the use of Interop in .NET C#. This functionality is essential when working with Excel files programmatically in business applications.

Quickstart: Add a Hyperlink with IronXL in Just a Few Steps

This example shows how easy it is to add a web hyperlink to an Excel cell using IronXL. In just a few lines - create the workbook, set the cell value, assign the hyperlink, and save - you'll have an interactive link in your spreadsheet. For more comprehensive Excel manipulation, explore our guide on editing Excel files in C#.

  1. 1Install IronXL with NuGet Package Manager

    PM > Install-Package IronXL.Excel

  2. 2Copy and run this code snippet.

    IronXL.WorkBook workbook = IronXL.WorkBook.Create(IronXL.ExcelFileFormat.XLSX);
    workbook.DefaultWorkSheet.GetCellAt(0, 0).Value = "Visit IronXL Docs";
    workbook.DefaultWorkSheet.GetCellAt(0, 0).Hyperlink = "https://ironsoftware.com";
    workbook.SaveAs("hyperlink_quick.xlsx");
    C#
  3. 3Deploy to test on your live environment

    Start using IronXL in your project today with a free trial
    arrow pointer

What Prerequisites Do I Need?

Before implementing hyperlinks, ensure you have IronXL installed in your .NET project. You'll also need a basic understanding of selecting ranges and managing worksheets in IronXL. The library supports .NET Framework 4.6.2+ and .NET Core/5/6/7/8+, making it compatible with most modern .NET applications.


The Hyperlink property exists in the Cell class. The worksheet["A1"] code returns a Range object; use the First method to access the first cell in the range.

Alternatively, directly access the cell using the GetCellAt method, allowing you to access the Hyperlink property directly. This approach is particularly useful when working with specific cell coordinates in your spreadsheets.

Let's explore an example of creating link hyperlinks. Both HTTP and HTTPS protocols are supported, enabling you to link to secure and non-secure web resources. When creating hyperlinks, consider combining them with cell formatting to make them visually distinct from regular text.

Warning: Using the GetCellAt method to select an unmodified cell will throw System.NullReferenceException: 'Object reference not set to an instance of an object.'
using IronXL;

WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Modify the cell's property
workSheet["A1"].Value = "Link to ironpdf.com";

// Set hyperlink at A1 to https://ironpdf.com/
workSheet.GetCellAt(0, 0).Hyperlink = "https://ironpdf.com/";

workBook.SaveAs("setLinkHyperlink.xlsx");

When you click a hyperlink created with IronXL, Excel prompts you to open the linked URL in your default web browser. The cell maintains its original value while adding the hyperlink functionality, allowing you to preserve descriptive text while enabling navigation. This behavior is consistent whether you're working with Excel files locally or deploying to cloud environments.

Excel spreadsheet showing 'Link to rongdf.com' text in cell A1, demonstrating hyperlink creation setup

To create a hyperlink to a cell within the same worksheet, use the cell's address, such as Z20. To create a hyperlink across worksheets, use the address convention worksheetName!address. For example, Sheet2!A1. This cross-worksheet linking capability is essential when building complex Excel reports with multiple data sheets.

Defined name cells can have either workbook (global) or worksheet scope. To create a hyperlink to a defined name within the same worksheet or a defined name with workbook scope, specify the name directly. To create a hyperlink for a defined name with worksheet scope on a different worksheet, specify the worksheet name as mentioned above. For example, Sheet2!Iron. Learn more about working with named ranges for advanced Excel automation.

using IronXL;
using System.Linq;

WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet workSheet1 = workBook.CreateWorkSheet("Sheet1");
WorkSheet workSheet2 = workBook.CreateWorkSheet("Sheet2");

// Create workbook(global) define name
workSheet1["D5"].SaveAsNamedRange("Iron", true);

// Create worksheet define name
workSheet2["D10"].SaveAsNamedRange("Hello", false);

// --== Within the same worksheet ==--
// Set hyperlink to cell Z20
workSheet1["A1"].Value = "Z20";
workSheet1["A1"].First().Hyperlink = "Z20";

// Set hyperlink to define name "Iron"
workSheet1["A2"].Value = "Iron";
workSheet1["A2"].First().Hyperlink = "Iron";

// --== Across worksheet ==--
// Set hyperlink to cell A1 of Sheet2
workSheet1["A3"].Value = "A1 of Sheet2";
workSheet1["A3"].First().Hyperlink = "Sheet2!A1";

// Set hyperlink to define name "Hello" of Sheet2
workSheet1["A4"].Value = "Define name Hello of Sheet2";
workSheet1["A4"].First().Hyperlink = "Sheet2!Hello";

workBook.SaveAs("setHyperlinkAcrossWorksheet.xlsx");

Named ranges provide more maintainable hyperlinks that survive worksheet restructuring. When you rename or move cells, hyperlinks pointing to named ranges automatically update, reducing broken links in your Excel applications. This approach is particularly valuable in dynamic reports where data positions may change.

Excel worksheet showing hyperlink setup with 'A1 of Sheet2' reference and defined name for cross-sheet linking

What's the Difference Between Workbook and Worksheet Scope?

Workbook scope (global) named ranges are accessible from any worksheet within the workbook, while worksheet scope names are only accessible within their specific worksheet. When creating hyperlinks to named ranges, workbook scope names provide more flexibility, but worksheet scope names offer better encapsulation for sheet-specific data. This distinction becomes crucial when managing multiple worksheets in complex Excel applications.


In addition to the hyperlink types mentioned earlier, IronXL also supports the creation of FTP, file, and email hyperlinks. These specialized hyperlink types expand your Excel automation capabilities beyond simple web links.

  • FTP: Starting with ftp:// - Links to files on FTP servers
  • File: Specify an absolute path starting with file:/// - Links to local or network files
  • Email: Starting with mailto: - Creates clickable email addresses
Please note: Both FTP and File hyperlinks require the use of absolute paths.
using IronXL;
using System.Linq;

WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Set hyperlink to open file sample.xlsx
workSheet["A1"].Value = "Open sample.xslx";
workSheet["A1"].First().Hyperlink = "ftp://C:/Users/sample.xlsx";

// Set hyperlink to open file sample.xlsx
workSheet["A2"].Value = "Open sample.xslx";
workSheet["A2"].First().Hyperlink = "file:///C:/Users/sample.xlsx";

// Set hyperlink to email example@gmail.com
workSheet["A3"].Value = "example@gmail.com";
workSheet["A3"].First().Hyperlink = "mailto:example@gmail.com";

workBook.SaveAs("setOtherHyperlink.xlsx");

Use file hyperlinks (file:///) for local files or network shares accessible through the Windows file system. FTP hyperlinks (ftp://) are ideal for linking to files on FTP servers, particularly in enterprise environments where documents are stored on dedicated file servers. Consider security implications when using FTP links, as they may transmit credentials in plain text.

Other Types of Hyperlinks

When users click mailto links in Excel, their default email client opens with a new message pre-addressed to the specified email. This works with Outlook, Thunderbird, and web-based email clients configured as system defaults. You can enhance mailto links with subject lines and body text using standard mailto syntax: mailto:example@gmail.com?subject=Hello&body=Message.


To remove a hyperlink, invoke the RemoveHyperlink method. This method can be accessed from the cell object. Removing hyperlinks is useful when cleaning data or converting linked reports to static documents.

using IronXL;
using System.Linq;

WorkBook workBook = WorkBook.Load("setLinkHyperlink.xlsx");
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Remove hyperlink
workSheet["A1"].First().RemoveHyperlink();

workBook.SaveAs("removeHyperlink.xlsx");

No, removing a hyperlink preserves the cell's value and formatting. Only the hyperlink functionality is removed, leaving the display text intact. This makes it safe to remove hyperlinks without data loss, which is particularly important when converting spreadsheet file types or preparing documents for archival.

To remove multiple hyperlinks efficiently, iterate through a range of cells or use LINQ to process cells containing hyperlinks:

// Remove all hyperlinks in column A
for (int i = 1; i <= 10; i++)
{
    var cell = workSheet.GetCellAt(i, 0);
    if (cell != null && !string.IsNullOrEmpty(cell.Hyperlink))
    {
        cell.RemoveHyperlink();
    }
}

This approach is particularly useful when cleaning imported data or preparing spreadsheets for distribution where hyperlinks might not be appropriate. For more advanced cell manipulation techniques, explore our guide on selecting and working with ranges.

Frequently Asked Questions

How can I create hyperlinks in an Excel sheet using C#?

Using IronXL, you can create hyperlinks in Excel cells programmatically in C# by utilizing the 'Hyperlink' property of the cell object. This allows you to add URLs, file paths, email addresses, and cell references directly into your spreadsheet without the need for Interop.

What types of hyperlinks can I create with IronXL?

IronXL supports several types of hyperlinks including web URLs, file paths, FTP links, email addresses, and cell references across different worksheets, allowing for versatile navigation within and outside the spreadsheet.

Do I need any specific prerequisites to use IronXL for creating hyperlinks?

The prerequisites include having IronXL installed in your .NET project environment. It supports .NET Framework 4.6.2+ and .NET Core/5/6/7/8+, ensuring compatibility with most modern applications.

Can I remove hyperlinks from an Excel sheet using IronXL?

Yes, you can remove hyperlinks by accessing the cell and invoking the 'RemoveHyperlink' method. This will delete the hyperlink without affecting the cell content or formatting.

How can I create a hyperlink to another worksheet within the same Excel file?

With IronXL, you can create cross-worksheet hyperlinks by using the address convention 'worksheetName!address', allowing you to link to a specific cell or range in another worksheet.

What is the advantage of using named ranges for hyperlinks?

Named ranges allow for more maintainable hyperlinks that automatically adjust to worksheet restructuring, preventing broken links and ensuring that your hyperlinks remain accurate as your data layout changes.

How can I create FTP or file hyperlinks in an Excel sheet using IronXL?

IronXL supports FTP and file hyperlinks. To create them, use absolute paths starting with 'ftp://' for FTP and 'file:///' for local or network files, enabling access to documents stored on servers or shared locations.

What happens when I click a hyperlink created with IronXL in an Excel file?

Clicking a hyperlink will open the linked URL in your default web browser or trigger the appropriate application to handle the link, such as opening an email client for mailto links.

Does IronXL support the creation of email hyperlinks in Excel?

Yes, with IronXL, you can create email hyperlinks using the 'mailto:' scheme, which prompts the default email client to prepare a new message with a pre-addressed email recipient when clicked.

How can I enhance the appearance of hyperlinks in my Excel spreadsheet?

You can use formatting options within IronXL to set cell styles, such as fonts and colors, ensuring hyperlinks are visually distinct from regular text, enhancing usability and readability.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 2,237,574Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronXL.Excel
nuget.org/packages/IronXL.Excel/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronXL"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronXL to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronXL.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required