纯js将json文件生产excel


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>json导出Excel</title>

    <script type="text/javascript" src="JsonExportExcel.js"></script>
    <script>
    window.onload=function () {
        var option={};
        option.fileName = 'excel'
        option.datas=[
          {
            sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}],
            sheetName:'sheet',
            sheetFilter:['two','one'],
            sheetHeader:['第一列','第二列'],

          },
          {
            sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}]
          }
        ];
        var toExcel=new ExportJsonExcel(option);
        toExcel.saveExcel();
    };
    </script>
</head>
<body>
</html>

来源:https://github.com/cuikangjie/JsonExportExceljs地址纯js将json文件生产excelhttps://raw.githubusercontent.com/cuikangjie/JsonExportExcel/master/dist/JsonExportExcel.min.js

上一篇:获取到select下的所有option的文字和值


下一篇:jest+vue-test-utils初步实践