angular.js export json to excel
علی ذوالفقار
1399/09/12 15:41:54 (43)
you need to use this tow lib :
     alasql.min.js 
     xlsx.core.min.js 
like this :
    <script src="/uploads/assets/js/alasql.min.js"></script>
    <script src="/uploads/assets/js/xlsx.core.min.js"></script>
export method is :

    $scope.exportToExcel = ()=>{
        var fields = "ullname as [name] , idno as [id number]";
       alasql('SELECT ' + fields + ' INTO XLSX("file.xlsx",{headers:true}) FROM ?', [$scope.data]);
    };

Back