0

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,

user3321757
  • 37
  • 1
  • 8
  • I guess, if there was such a thing as `file.removePassword()`, then there wouldn't really be any point in password-protecting a file, would there? – Jeremy Thille Apr 30 '21 at 08:33
  • Thanks Jeremy for your quick reply, i don't want to remove the password, i just want to know if any password related methods is there in that plugin, meantime if it is fine to provide password statically – user3321757 Apr 30 '21 at 08:45

0 Answers0