save excel file using FileSaver.js

丶灬走出姿态 提交于 2019-12-01 17:15:48

Try the following code that will help you to create an excel file for you.

var result = ["Item 1", "Item 3"];
const myJsonString = JSON.stringify(result);
const blob = new Blob([myJsonString], {
  type: "application/vnd.ms-excel;charset=utf-8"
});
saveAs(blob, "Report.xls");

Demo

 csv = ['name','md5','desc']
  _.map $scope.trustFileList, (_file) ->
    csv.push "\n#{_file.name}"
    csv.push _file.md5
    csv.push _file.desc

  blob = new Blob([csv], {
    type: "application/json;charset=utf-8"
  });

  saveAs(blob, "TrustFileWhiteList.xls");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!