如何用JavaScript读取Excel文件(没有ActiveXObject) [英] How can I read an Excel File with JavaScript (without ActiveXObject)
问题描述
我的朋友要求我制作一个简单的应用程序,从Excel文件生成图表(条形图,曲线)。我选择使用JavaScript作为一种语言,因为我已经知道了强大的chart.js。但是在使用chart.js之前,我必须从Excel文件中收集数据。那么如何通过JavaScript读取Excel文件?
My friend asked me to make for a simple application to generate charts (bar, curves) from an Excel file. I opted to use JavaScript as a language since I know already the powerful chart.js. However before using chart.js, I have to gather data from the Excel file. So how to read an Excel file via JavaScript?
经过一些研究,我已经设法使用Internet Explorer(使用ActiveX)完成此操作,但我需要在浏览器之间工作。
After some research I have managed to do this with Internet Explorer with (using ActiveX), but I need it to work across browsers.
推荐答案
有一些JavaScript库,允许 XLS & XLSX 以纯JavaScript解析。我用Chrome测试(虽然在Windows上),但是它工作正常。
There are JavaScript libraries which allow XLS & XLSX to be parsed in pure JavaScript. I tested with Chrome (albeit on Windows) and it worked fine.
这篇关于如何用JavaScript读取Excel文件(没有ActiveXObject)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!