0

I'm exporting some tabledata to Excel using the Jquery module Table2Excel. It works fine but Excel throws the following error when opening.

enter image description here

After closing the message box the data shows up. There is an accepted answer to this issue here: Excel Error However, it does not fix the problem.

Here is the function:

<script src="https://cdn.rawgit.com/unconditional/jquery-table2excel/master/src/jquery.table2excel.js"></script>
<script>
  jQuery(document).ready(function() {    
  $('#exportNow').on('click', function(e){
      e.preventDefault();
      ResultsToTable();
  });      
  function ResultsToTable(){    
      $("#tabledata").table2excel({
          exclude: ".noExl", //this class data should not be excluded in excel
          filename: "SummaryReport"
      });
  }
   });
</script>
Mike C.
  • 1,761
  • 2
  • 22
  • 46
  • The error from the other post was something else. Your error seems to be related to the file type. Have you tried to configure your code to safe the file with another extension? – The Fool Jan 20 '20 at 18:22
  • Does this answer your question? [Excel file generated by table2excel jQuery plugin throws error when opened](https://stackoverflow.com/questions/33031702/excel-file-generated-by-table2excel-jquery-plugin-throws-error-when-opened) – The Fool Jan 20 '20 at 18:24
  • @TheFool Sorry that was the link that I intended to include in my original posting. I edited that. That solution still throws the error. – Mike C. Jan 20 '20 at 18:31

1 Answers1

0

Please note that for some reason, your file got hte name "SummaryReport.xlsx-1.xls" The name of your file must be extended with .xls as in the other So-Post you cited

filename: "SummaryReport.xls"
Meziane
  • 1,586
  • 1
  • 12
  • 22