HOWTO: Link to a Sheet, or Named Area, of an Excel File in HTML

ID: Q197922


The information in this article applies to:


SUMMARY

There may be times when you want to use links or JScript in a Web page to offer quick access to different parts of an Excel Document. For example, you might offer departmental statistics on an intranet site that links easily to charts or previous months' reports in the same document.

You can open an Excel 97 file to a named area, or any sheet and cell from a anchor link or script in an HTML page as long as the HTML page is accessed via http ( not by double-clicking it in Windows Explorer, nor using file://) and Excel is opened within the browser. If Excel is opened outside of the browser, it will not move to the specified link.


MORE INFORMATION

The syntax is based on standard Excel syntax. You can use this method in a frame declaration, an anchor tag, or even in script when using location.href.

This HTML demonstrates how the links and Jscript look:


<HTML>
<HEAD>
<Title>Excel Linking Example</Title>
</HEAD>
<body>
<p>
<a href="http://localhost/excel/asheet.xls#Sheet2!D4">
This link will open the Excel file to the second page with the focus on
cell D4</a>.
<a href="http://localhost/excel/asheet.xls#TableName">
This link will set the focus on a named area of the spreadsheet
</a>.
</p>
<form>
<input type=button
 value="Via Jscript"
 onclick='location.href = "asheet.xls#TableName"'>
</form>
</body>
</html> 
Make sure you create an Excel file with a named cell, and change the HTML above to reflect the name of your Excel file, and the named area.

Notes

The names linked to are not case-sensitive.

If the link is specified with a file:// type URL, there will be an error. In this circumstance, the whole link is treated like the file name.

A fully qualified URL is not necessary; that is, you can use href="linkpage2.xls#TableName" as long as the browser, or frameset was loaded using http:// rather than file://.

In a frameset scenario, you can link to different parts of the Excel file, from the other frame, without causing a reload. This is interesting because normal security does not allow you to directly access the Excel object in the browser.

Although you can link to an Excel 95 file, you cannot navigate through it in this method.


REFERENCES

For additional information, please see the following articles in the Microsoft Knowledge Base:

Q178222 HOWTO: Launch Word from Internet Explorer
Q185978 BUG: Double GET and Cookies Lost with Word or Excel
Q162059 Office Documents Open in Internet Explorer
Q157417 XL97: Unable to Use File URL in Linking Formulas
Q189155 XL98: Unable to Use File URL in Linking Formulas


(c) Microsoft Corporation <year>, All Rights Reserved. Contributions by Heidi Housten, Microsoft Corporation.

Additional query words:


Keywords          : kbIE300 kbIE301 kbIE400 kbIE401 kbIE302 kbIE401sp1 kbIE500dp1 kbIE500 
Version           : WINDOWS:3.0,3.01,3.02,4.0,4.01,4.01 SP1,4.01 SP2,5.0,5.0dp1,5_beta
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: April 28, 1999