# 4.7.1 Inserting Links into Worksheet Cells

## URL Links

### Inserting URL Links into Worksheet Cells

To insert live links into worksheet cells, simply begin URLs with http:// or https://. The link will become active when you finish editing, and will open in a web browser when clicked. To edit the link, press and hold down the mouse button for more than 1 sec. and then release the mouse.

To insert a link with display text different from the URL, use the following syntax:

URL DisplayedText

Note the white space between the URL and the displayed text.

For example, if you enter http://www.originlab.com here, the word “here” appears in the cell. When clicked, a web browser opens to the OriginLab website.

Note: Substitution notation is supported in DisplayedText part.E.g., if a string variable str$=Homepage, then http://www.originlab.com %(str$) will display as a hyperlink text Homepage in cell.
This applies to other links below with DisplayedText option.

### Inserting URL Links into Graphs

You can also insert hyperlinked text objects into graphs:

1. Click the Text Tool button on the Tools toolbar. Place the cursor in the graph and type OriginLab.
2. Right-click the text, and then select Programming Control...
3. In the Script, Run After drop-down menu, select None. In the text box below, type http://www.originlab.com. The text will now appear as a live link, and will open a browser to the OriginLab website when clicked.
To make the text label appear as a button, select Button Up from the Script, Run After drop-down menu, and then enter either of the following commands in the text box.
run -lk "URL"
or
win -aw "URL"
Click OK to close the dialog.

## Internal Links

### Inserting Internal Links into Worksheet Cells

To insert internal links to ranges, begin with range://, and then follow with book, sheet, and column information, using the syntax in these examples:

range://[book1]sheet2
This will activate Sheet2 in Book1.
range://[book1]sheet2!col(2)[10]
This will activate Sheet2 in Book1; the tenth row of the second column will display at the top of the worksheet.

To display text that differs from the actual link, use this syntax:

InternalLink DisplayedText

Note the white space between the internal link and the displayed text.

For example, if you enter range://[book1]sheet2 Go to Book1 Sheet2, the word Go to Book1 Sheet2 will appear in the cell. When clicked, sheet2 of book1 will be activated.

Or use substitution notation of to show 1st sheet name in active book as displayed text.

### Inserting Internal Links into Graphs

You can also use a text label with an internal link to activate a range of data:

1. Click the Text Tool button on the Tools toolbar. Place the cursor in the graph and type Sheet2, column2 ,row10.
2. Right-click the text, and then select Programming Control....
3. In the Script, Run After drop-down menu, select None. In the text box below, type the internal link range://[Book1]sheet2!col(2)[10]. The text will now appear as a live link, and when clicked will activate Sheet2 in Book1 at the tenth row of column 2.
To make the text appear as a button, select Button Up from the Script, Run After drop-down menu, and then enter the following command:
run -lk "range://[Book1]sheet2!col(2)[10]"

### Links to Show Contents From Other Cell

Show contents of another cell by cell://[BookName]SheetName/SheetIndex!ColumnName/Col(Name)[rowindex]
The following link will show A[1] content on Sheet1 in Book1.

cell://[book1]sheet1!col(A)[1]
cell://[book1]sheet1!A[1]
cell://[book1]1!col(A)[1]
cell://[book1]1!A[1]

Note:

1. If using sheetindex, after pressing Enter, it will be automatically converted to sheet name. E.g. if you type cell://[book1]1!A[1] and later double click on it, it will show cell://[book1]Sheet1!A[1]
2. When the cell is on the same sheet or different sheet on same book, The samebook and samesheet part(s) can be omitted. E.g. cell://col(A)[1] or cell://A[1] or cell://sheet2!A[1]
 Origin 2018 SR0 and later support a simplified notation for displaying numeric content from other cells and performing cell-level calculations. To learn more, see Using a Formula to Set Cell Values.

## Help Link

### Inserting Help Links into Worksheet Cells

To insert links to Origin Help documents, begin with help://, and then follow with the link to the Help page. For example:

Help://TUTORIAL.CHM/Tutorial/Import_Wizard.html

The link will become active when you finish editing, and will open in a web browser when clicked.

To insert a link with display text different from the URL, use the following syntax:

 HelpLink DisplayedText

Note the white space between the Help link and the displayed text.

For example, if you enter help://TUTORIAL.CHM/Tutorial/Import_Wizard.html here, the word “here” appears in the cell. When clicked, a web browser opens to the Import Wizard page in the Origin Help document.:

### Inserting Help Links into Graphs

You can also insert hyperlinked text objects into graphs:

1. Click the Text Tool button on the Tools toolbar. Place the cursor in the graph and type OriginLab.
2. Right-click the text, and then select Programming Control...
3. In the Script, Run After drop-down menu, select None. In the text box below, type help://TUTORIAL.CHM/Tutorial/Import_Wizard.html. The text will now appear as a live link, and will open a browser to the Import Wizard page in the Origin Help document.
To make the text label appear as a button, select Button Up from the Script, Run After drop-down menu, and then enter the appropriate code in the text box. For example:
 run -lk "help://TUTORIAL.CHM/Tutorial/Import_Wizard.html""
Click OK to close the dialog.

## Links to LabTalk Variables

To insert a link to a LabTalk variable, use the following syntax:

var://VariableName

For example, the value of the variable MyVar is 3.14. If you enter var://MyVar in a worksheet cell, you will see 3.14 displayed. The displayed value changed with the value of the variable.

If the LabTalk variable is a string variable, the following syntax can be used also:

str://StringVariableName$ For example, the value of the variable MyBook$ is Book7. If you enter str://MyBook$or var://MyBook$ in a worksheet cell, you will see Book7 displayed. The displayed value changes with the value of the variable.

In the example below, str://[%H]1!wks.name$shows 1st sheet name on current book, e.g. "Step01", where %H refers to current book, 1! means 1st sheet. Change it to str://Descriptive Statistics - %([%H]1!wks.name$) to show Descriptive Statistics - Step01

.
 Note: These var:// and str:// notations only work with the old "col(N)" syntax -- not the newer spreadsheet cell notation that was introduced in Origin 2017 SR0. Note that the older notation supports cell-level calculations using var:// as in: var://max(col(A))*2 //find the max value in column A and multiply by 2 However, there is a new-and-improved notation for doing such cell-level calculations. For more information, see Using Formulas to Set Cell Values.

## Links to Graph/Matrix/Notes Windows

### Links to Graph Window

To manually add a link to a graph window into a worksheet cell, use the syntax:

graph://GraphName

This inserts a linked image of the graph into the cell. Double-clicking on the cell activates the graph window.

A better method for linking to a graph window is to right-click on the worksheet cell and choose Insert Graph. This opens the InsertGraph dialog box. Expand the Options branch and disable Move Graph to cell [Embedding]. The advantage of this method is that you can choose other options for displaying the linked graph.

### Links to Matrix Window

To add a link to a matrix window into a worksheet cell, use the syntax:

 matrix://[MatrixBookName] // link to matrixbook matrix://[MatrixBookName]MatrixSheetName! // link to matrixsheet matrix://[MatrixBookName]MatrixSheetName!MatrixObjectNumber // link to matrix object 

For example, there is a matrix object in matrixsheet of matrixbook, named [MBook1]MSheet1!1, then add matrix://[MBook1]MSheet1!1 into a worksheet cell, then this cell will show the image mode (like a thumbnail) of the matrix object. If double-click on this cell, the matrix object will be activated.

### Links to Notes Window

To manually add a link to an existing Notes window into a worksheet cell, use the syntax:

notes://NotesName

For example, there is a Notes window named Notes, then add notes://Notes into a worksheet cell, then a link is available to this Notes window. If click on this link, the Notes window will be activated.

To simultaneously create and link to a new Notes window, simply right-click on a worksheet cell and choose Insert Notes from the shortcut menu.

To insert a link with display text different from the URL, use the following syntax:

 NoteLink DisplayedText

## Links to Image File

The following syntax is used to link an image file into a worksheet cell, and the image will display in the worksheet cell.

file://ImagePath

For example, there is an image file located in E:\ drive, and named Flower.jpg. Then add file://E:\Flower.jpg into a worksheet cell, and the image will show there.

 Note: There is an alternate way to link an image in a worksheet cell to an external image file and that is explained here under Image From File.