简体   繁体   English

用Javascript读写Excel文件

[英]Read and Write Excel file in Javascript

Is there any API or method to read and write Excel file in Javascript?I would like to know whether we can update 1000's of records in Excel in one row. 我是否有任何API或方法可以用Javascript读写Excel文件?我想知道是否可以在一行中更新Excel中的1000条记录。

Help would be appreciated. 帮助将不胜感激。

You can try this 你可以试试这个

 function GetData() { var excel = new ActiveXObject(“Excel.Application”); var excel_file = excel.Workbooks.Open(“H: /sample_Codes/sample.xls”); var excel_sheet = excel.Worksheets(“Sheet1″); var totalColCount = excel_sheet.UsedRange.Columns.Count; var totalRowCount = excel_sheet.UsedRange.Rows.Count; var htmlStr = ” < table > ”; for (i = 0; i < totalRowCount; i++) { htmlStr = htmlStr + “ < tr > ”; for (j = 0; j < totalColCount; j++) htmlStr = htmlStr + “ < td > ”+excel_sheet.Cells(i, j).Text + “ < /td>”; htmlStr = htmlStr + “</tr > ”; } document.getElementById('ExcelContent').innerHTML = htmlStr; } 

But this code requires Excel to be available in the client machine 但是此代码要求Excel在客户端计算机中可用

您可以将电子表格转换为CSV文件并阅读吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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