如何使用 JavaScript 导出 Excel 文件? [英] How can I export Excel files using JavaScript?

查看:27
本文介绍了如何使用 JavaScript 导出 Excel 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过Javascript生成Excel/CSV?(也应该是浏览器兼容的)

Is there any way to generate Excel/CSV through Javascript? (It should be browser compaatible too)

推荐答案

github 上有一个有趣的项目,叫做 Excel Builder (.js)它提供了一种下载 Excel xlsx 文件的客户端方式,并包括用于格式化 Excel 电子表格的选项.
https://github.com/stephenliberty/excel-builder.js

There is an interesting project on github called Excel Builder (.js) that offers a client-side way of downloading Excel xlsx files and includes options for formatting the Excel spreadsheet.
https://github.com/stephenliberty/excel-builder.js

使用此库时,您可能会遇到浏览器和 Excel 兼容性问题,但在合适的条件下,它可能非常有用.

You may encounter both browser and Excel compatibility issues using this library, but under the right conditions, it may be quite useful.

可以在此处找到另一个具有较少 Excel 选项但较少担心 Excel 兼容性问题的 github 项目:ExcellentExport.js
https://github.com/jmaister/excellentexport

Another github project with less Excel options but less worries about Excel compatibility issues can be found here: ExcellentExport.js
https://github.com/jmaister/excellentexport

如果您使用的是 AngularJS,则有 ng-csv:
一个将数组和对象转换为可下载的 CSV 文件的简单指令".

If you are using AngularJS, there is ng-csv:
a "Simple directive that turns arrays and objects into downloadable CSV files".

这篇关于如何使用 JavaScript 导出 Excel 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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