[英]how to get the data from excel file in javascript?
在這里我想使用上傳文件控件從Excel File獲取數據。我的代碼段是
<script type="text/javascript">
function my_function() {
var Excel;
Excel = new ActiveXObject("Excel.Application");
Excel.Visible = false;
return Excel.Workbooks.Open("C:\Users\admin\Desktop\Bennu.xlsx").ActiveSheet.Cells(l, i).Value;
}
var i = 1;
var l = 1;
do {
a = my_function()
if (a != null) {
document.write("value is " + a + "  ;  ;  ;  ;");
i++;
}
else {
l++;
i = 1;
document.write("<br />");
}
b = my_function()
} while (a != null || b != null);
當我在上面運行時,我什么都沒得到
那里有幾個問題,其中最主要的是您正在使用ActiveX對象。 僅當用戶啟用了IE,並且僅當頁面在受信任/內聯網區域中運行時,這才在IE中起作用,並且僅在IE的舊版本中起作用。 除了IE之外,沒有其他瀏覽器支持ActiveX對象,甚至IE也不再支持。
另外,在初始頁面加載后使用document.write
將擦除頁面。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.