Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 activeXObject is not defined
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cool dude




PostPosted: Sat Sep 03, 2011 2:35 pm   Post subject: activeXObject is not defined

Hello,

Since I did not see a javascript section I wasn't sure where to post so please move if this is wrong place.

My problem:

I'm trying to read from an excel file in JavaScript. When I open this in Chrome I get the error: "activeXObject is not defined". My guess is that chrome doesn't support activeX. What can I do as a work around and please don't say IE. I like chrome as it has Web Inspector built in so I can debug code.

Here is just some code i'm trying to play around with to make it work (not necessarily correct code).

code:

<html>
<body>
<script type='text/javascript'>

function readData(x,y)
{
    var excel=new ActiveXObject("Excel.Application");
        var book = excel.Workbooks.Open("my.xls");
        var sheet = book.Sheets.Item(1);
        var data = excel_sheet.cells(x,y).value; //x,y consider the coordinate of row and column or the data
    return data;
}

var value = readData(1,1);  //this should read cell A1
document.write("Value from Excel file is " + value);

</script>
</body>
</html>
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Sep 03, 2011 3:01 pm   Post subject: RE:activeXObject is not defined

I talked to you on IRC half an hour ago (I go by Soup in the chat room).

Anyway, apparently ActiveX is IE-only, so it won't (or shouldn't) work in other browsers.

Also, it's true there isn't a Javascript section, however there is a web design section you can use in the future.
cool dude




PostPosted: Sat Sep 03, 2011 7:30 pm   Post subject: Re: activeXObject is not defined

Thanks Insectoid. That's what I figured. I guess that raises 2 questions

1. (original question) Is there a way around it? I saw some activeX plugin for chrome but the code still didn't work with that plugin.

2. Is there another way to read from excel file in JavaScript instead of using activeX?

Thanks!
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: