72753/how-to-parse-excel-file-in-javascript-html5
Hello @kartik,
Below Function converts the Excel sheet (XLSX format) data to JSON. you can add promise to the function.
<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.8.0/xlsx.js"></script> <script> var ExcelToJSON = function() { this.parseExcel = function(file) { var reader = new FileReader(); reader.onload = function(e) { var data = e.target.result; var workbook = XLSX.read(data, { type: 'binary' }); workbook.SheetNames.forEach(function(sheetName) { // Here is your object var XL_row_object = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheetName]); var json_object = JSON.stringify(XL_row_object); console.log(json_object); }) }; reader.onerror = function(ex) { console.log(ex); }; reader.readAsBinaryString(file); }; }; </script>
Hope this is helpful!!
Thank You!!
Hello @Nik,
Can you be more specific about what you want? or Do you want know about calling function from one javascript file from another?
Hii, This works in all browsers: window.location.href = '...'; If ...READ MORE
Hello, You can use fs.existsSync(): const fs = require("fs"); // ...READ MORE
Hello @kartik, To resolve this error you can ...READ MORE
Hello @kartik, The double curly brackets {{ }} will always ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
Hello @kartik, For reading the external Local JSON ...READ MORE
Hello, You can produce the javascript file via ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.