Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

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.





Thanks,

What I have tried:

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

Posted
Comments
SeanChupas 30-Apr-21 11:10am    
Can you do this server side instead of using JavaScript?
Richard Deeming 30-Apr-21 12:21pm    
Maybe you need to investigate the password: NULL parameter you're passing to the XLSX.read function?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900