Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, March 11, 2014

How to provide hyperlinks in excel sheet using C# or any programming language

If you are writing program to put records in excel file from C# or any programming language.

Sometimes we need to provide hyper links to some data so that when user click on those cells, a link should be opened. This is very tedious works to write a code for hyperlinks in excel cells.

How can you do it in easy way?

Excel comes with their own formulas. So for hyperlink, excel provides HYPERLINK formula with two parameters
1.         Link location i.e. URL address
2.         Friendly name i.e. Display Text and its optional

Example 1:

=HYPERLINK("http://www.techgig.com/", "Click Here")

This should display text "Click Here" in cell. When user click on it, excel opened site "http://www.techgig.com/"

Example 2:
If you have some files in along with excel file in the same folder and you want to open those file from excel file by providing links in excel cells then use below formula

=HYPERLINK(".\File_In_Same_Folder.xlsx", "Open Test File")

Here dot in ".\File_In_Same_Folder.xlsx" indicates that use current directory path as of excel file and open "File_In_Same_Folder.xlsx" file.

Use HYPERLINK formula for excel sheet from programming language.


Please leave your comments or share this tip if it’s useful for you.

No comments:

Post a Comment