XLSX.read Javascript API unprotect password in JavaScript

773 views Asked by At

I am using XlSX.Read Javascript API to upload excel file, while trying to upload the excel file i need to un protect or remove the password, or any other way to un protect or input the password in Javascript, i have attached the code below for your reference, please check.

<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',
       password: NULL
  });

    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);
   };
 };

Please refer this below link:

How to parse Excel (XLS) file in Javascript/HTML5

enter image description here

Thanks,

0

There are 0 answers