How To Link to a Sheet, or Named Area, of an Excel File in HTML

Article translations Article translations
Article ID: 197922 - View products that this article applies to.
This article was previously published under Q197922
Expand all | Collapse all

On This Page

SUMMARY

There may be times when you want to use links or Microsoft 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.
  • When you reference a sheet name that includes a space, you must enclose the sheet name in single quotation marks (for example, <a href="/?scid=asheet.xls%23%27sheet%20two%27%21d4">). If you do not do this, you may receive the following error message when you click the hyperlink in the Web page:
    Reference is not valid

REFERENCES

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
178222 How to launch Word from Internet Explorer
185978 FIX: Double GET requests and cookies are lost with Word 2000 or Excel 2000
162059 Office documents open in Internet Explorer
157417 XL97: Unable to use file URL in linking formulas
189155 XL98: Unable to use file URL in linking formulas

Properties

Article ID: 197922 - Last Review: July 2, 2004 - Revision: 2.3
APPLIES TO
  • Microsoft Internet Explorer 3.0
  • Microsoft Internet Explorer 3.01
  • Microsoft Internet Explorer 3.02
  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer (Programming) 5_beta
  • Microsoft Excel 97 Standard Edition
Keywords: 
kbhowto KB197922
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com