简体   繁体   中英

how to read a excel file without using ActiveXObject in javascript

I want to read content of an excel file using javascript. But I getting an error 'ActiveXObject am not defined' when I used ActiveXObject for this purpose ActiveXObject. Does any other way for reads excel file without using ActiveXObject? Here is my html code :-

<html>
    <body>
        <span class="img-upload">
           <input type="file" onchange="readfile()" id="csvfileButton" >
        </span>
    </body>
</html>

javascript code :-

function readfile(){
   var file    = document.getElementById('csvfileButton').files[0]
    function readData(x,y)
    {
        var excel=new ActiveXObject("Excel.Application");                 
        excel.workbooks.open(file);
        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
    alert("Value from Excel file is " , value);

}

ActiveXObject Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.x Store apps. See Version Information. Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.x Store apps. See Version Information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM