This code can help you. Most of the time jszip.js does not work, so include xlsx.full.min.js in your js code.
HTML code
<input type="file" id="file" ng-model="csvFile" onchange="angular.element(this).scope().ExcelExport(event)"/>
Javascript
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.10.8/xlsx.full.min.js"> </script> $scope.ExcelExport= function (event) { var input = event.target; var reader = new FileReader(); reader.onload = function(){ var fileData = reader.result; var wb = XLSX.read(fileData, {type : 'binary'}); wb.SheetNames.forEach(function(sheetName){ var rowObj =XLSX.utils.sheet_to_row_object_array(wb.Sheets[sheetName]); var jsonObj = JSON.stringify(rowObj); console.log(jsonObj) }) }; reader.readAsBinaryString(input.files[0]); };
afzalriz304 Jul 14 '17 at 6:16 2017-07-14 06:16
source share