Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
In this tutorial, viewers learn how to set up hyperlinks in Excel files using the IronXL library. The process begins with ensuring the IronXL library is installed via the NuGet package manager. The tutorial walks through a basic script that includes using statements for accessing IronXL features, creating workbooks, and worksheets. It explains how to set a hyperlink in cell A1 to the ironpdf.com website and how to navigate within the same worksheet by clicking on cell A1 to jump to cell Z20. Additionally, it demonstrates setting hyperlinks across different worksheets, such as linking cell A3 to cell A1 of sheet 2, and opening external Excel files by clicking on cell A5. The tutorial concludes by running the project to verify that links work as expected, showcasing the powerful interactivity features that IronXL offers for Excel files. Viewers are encouraged to subscribe for more tutorials and explore the software by following the provided link.
Here's an example script demonstrating how to create hyperlinks in Excel with IronXL.
// Include IronXL namespace for Excel operations
using IronXL;
class HyperlinksExample
{
static void Main()
{
// Load the existing workbook or create a new one
WorkBook workbook = WorkBook.LoadOrCreate("Example.xlsx");
// Select the first worksheet or create a new one
WorkSheet sheet = workbook.DefaultWorkSheet;
// Add a hyperlink to an external website
sheet["A1"].Hyperlink = new HyperLink("https://ironpdf.com", "Visit IronPDF");
// Add an internal hyperlink to navigate within the same worksheet
sheet["A2"].Value = "Go to Z20";
sheet["A1"].Hyperlink = new HyperLink("Z20");
// Create a new worksheet or fetch if it already exists
WorkSheet sheet2 = workbook.GetWorkSheet("Sheet2") ?? workbook.CreateWorkSheet("Sheet2");
// Add hyperlink to another worksheet cell
sheet["A3"].Hyperlink = new HyperLink(sheet2["A1"]);
// Add hyperlink to open an external Excel file (assuming 'External.xlsx' exists)
sheet["A5"].Hyperlink = new HyperLink("External.xlsx", "Open External File");
// Save changes to the Excel file
workbook.Save();
}
}
// Include IronXL namespace for Excel operations
using IronXL;
class HyperlinksExample
{
static void Main()
{
// Load the existing workbook or create a new one
WorkBook workbook = WorkBook.LoadOrCreate("Example.xlsx");
// Select the first worksheet or create a new one
WorkSheet sheet = workbook.DefaultWorkSheet;
// Add a hyperlink to an external website
sheet["A1"].Hyperlink = new HyperLink("https://ironpdf.com", "Visit IronPDF");
// Add an internal hyperlink to navigate within the same worksheet
sheet["A2"].Value = "Go to Z20";
sheet["A1"].Hyperlink = new HyperLink("Z20");
// Create a new worksheet or fetch if it already exists
WorkSheet sheet2 = workbook.GetWorkSheet("Sheet2") ?? workbook.CreateWorkSheet("Sheet2");
// Add hyperlink to another worksheet cell
sheet["A3"].Hyperlink = new HyperLink(sheet2["A1"]);
// Add hyperlink to open an external Excel file (assuming 'External.xlsx' exists)
sheet["A5"].Hyperlink = new HyperLink("External.xlsx", "Open External File");
// Save changes to the Excel file
workbook.Save();
}
}
' Include IronXL namespace for Excel operations
Imports IronXL
Friend Class HyperlinksExample
Shared Sub Main()
' Load the existing workbook or create a new one
Dim workbook As WorkBook = WorkBook.LoadOrCreate("Example.xlsx")
' Select the first worksheet or create a new one
Dim sheet As WorkSheet = workbook.DefaultWorkSheet
' Add a hyperlink to an external website
sheet("A1").Hyperlink = New HyperLink("https://ironpdf.com", "Visit IronPDF")
' Add an internal hyperlink to navigate within the same worksheet
sheet("A2").Value = "Go to Z20"
sheet("A1").Hyperlink = New HyperLink("Z20")
' Create a new worksheet or fetch if it already exists
Dim sheet2 As WorkSheet = If(workbook.GetWorkSheet("Sheet2"), workbook.CreateWorkSheet("Sheet2"))
' Add hyperlink to another worksheet cell
sheet("A3").Hyperlink = New HyperLink(sheet2("A1"))
' Add hyperlink to open an external Excel file (assuming 'External.xlsx' exists)
sheet("A5").Hyperlink = New HyperLink("External.xlsx", "Open External File")
' Save changes to the Excel file
workbook.Save()
End Sub
End Class
Further Reading: How to Create Hyperlink