Share this page 

Use ExcelTag(s): Varia

These scripts are for IE only

Launch Excel externally

<input type="button" value="excel (IE only)" onclick="startExcel();">
<script language="javascript">
function startExcel() {
 var xls = new ActiveXObject ( "Excel.Application" );
 xls.visible = true;
 var newBook = xls.Workbooks.Add;
 newBook.Worksheets(1).Cells(1,1).value="First Column, First Cell";
 newBook.Worksheets(1).Cells(2,1).value="First Column, Second Cell";
 newBook.Worksheets(1).Cells(1,2).value="Second Column, First Cell";
 newBook.Worksheets(1).Cells(2,2).value="Second Column, Second Cell";
 newBook.Worksheets(1).Name="WorkSheet from Javascript";
 // newBook.Worksheets(1).SaveAs("C:\\temp\\TEST2.XLS");
Try it here :

Excel embedded into the browser

You need a recent Office version with the OWC control installed. OWC means Office Web Components.

In the registry (HKEY_CLASSES_ROOT\CLSID), you locate the CLSID (or CLASSID) key for "Microsoft Office Spreadsheet 10.0" (if you have Office 10).


"Microsoft Office Spreadsheet 10.0"
The CLSID is the weird looking number at the end of the key.


width = 900
height = 500
id = 'excel'
classid = 'CLSID:0002E541-0000-0000-C000-000000000046' VIEWASTEXT>
<param name=DisplayTitleBar value=true >
<param name="DataType" value="CSVURL">
<param name="AutoFit" value="0">
<param name="DisplayColHeaders" value="1">
<param name="DisplayGridlines" value="1">
<param name="DisplayHorizontalScrollBar" value="1">
<param name="DisplayRowHeaders" value="1">
<param name="DisplayTitleBar" value="1">
<param name="DisplayToolbar" value="1">
<param name="DisplayVerticalScrollBar" value="1">
<param name="EnableAutoCalculate" value="0">
<param name="EnableEvents" value="0">
<param name="MoveAfterReturn" value="1">
<param name="MoveAfterReturnDirection" value="0">
<param name="RightToLeft" value="0">
<param name="XMLURL" value="">
<xparam name="HTMLURL" value="">
<xparam name="csvURL" value="">

excel.range('a14').value = '435';
excel.range('b14').value = '0';
excel.range('c14').value = 'yop!';
excel.range('d14').value = 'yip!';
excel.range('e14').value = '';

function boldexcel(){
excel.ActiveCell.EntireRow.Font.Bold = true;
function excelalert(){
function excelview(){
<button onclick="boldexcel()">bold</button>
<button onclick="excelalert()">alert</button>
<button onclick="excelview()">view</button>
Try it here (for IE only and Office 10).

Note :

  • OWC can not open XLS, only XML or HTML format.
  • OWC9 Spreadsheet control supports only a single sheet
  • OWC10 Spreadsheet control supports multiple worksheets.