I've used the following code to open Excel. It works but generates a browser error warning the visitor that the web page is trying to run an add-on with an unknown name, and control with an unknown name. Is there a better way to open Excel (read only) in order to read and display its contents? I have the code for reading/loading data. I'm just looking for a way to open Excel in Javascript to avoid the above error.

function loadexcel() {
var serverLoc = "http://www.mydomain.com/excel_folder/";
var serverFile = serverLoc+"myexcel.xls";

var ehandle = new ActiveXObject("Excel.Application");
var eWBhandle = ehandle.Workbooks.Open(serverFile);
var eShandle = eWBhandle.ActiveSheet;
// read cells and display on page

Any help would be appreciated!


8 Years
Discussion Span
Last Post by ms_sws

Thanks Taywin but not what I'm looking for. I've seen these examples in a number of places.

But to clarify, I want to open excel much like a database to read it's contents based on certain selection criteria, then display some data on my page. The file resides on the server.

So I just need the correct Javascript code to open the file for read access without errors, or at least with a friendly warning from the browser (aka to run an ActiveX object).


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.