如何在不使用javascript的情况下读取excel文件

问题描述:

我想使用javascript读取excel文件的内容。但是当我为此ActiveXObject使用ActiveXObject时,出现'ActiveXObject未定义'错误。是否有其他方式来读取excel文件而不使用ActiveXObject? 这里是我的html代码: -如何在不使用javascript的情况下读取excel文件

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

javascript代码: -

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.

+0

请给另一种用于读取Excel文件 –

+0

可以通过服务器端来helpd – zkimyes