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.

<head>
<script>
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!

MS

You may get some idea from this forum. The person is trying a similar way. If it is not what you are looking for, please ignore it.

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).

MS

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.