如何使用 JavaScript 读取 Excel 文件(没有 ActiveXObject) [英] How can I read an Excel File with JavaScript (without ActiveXObject)

查看:22
本文介绍了如何使用 JavaScript 读取 Excel 文件(没有 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆