我想使用javascript阅读excel文件的内容。但是当我为此目的使用ActiveXObject ActiveXObject时,我收到错误'ActiveXObject am not defined'。有没有其他方法可以在不使用ActiveXObject的情况下读取excel文件? 这是我的HTML代码: -
<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);
}
答案 0 :(得分:0)
的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.