I working on export html table to excel using JAVASCRIPT . I face issue it not export to excel office New version with extension xlsx .
but it working fine and export to old version office excel with extension xls .
when export from html table to excel new version with xlsx extension it give me error
cannot open file `.xlsx` because file extension is not valid or file corrupted .
so How to solve this issue to working with xlsx extension and open new version excel .
code for html and javascript that not export to excel new version xlsx
when debug var table it give me html table script as fiddle below so How to export to excel xlsx New version
html table generated by var table from debug
ahmed salahPosted May 17, 2024, 1:52 PM
I need to allow sheetjs on function below to export html table to excel xlsx using javascript
i need to export var table to excel using sheet js so how to do that please
Abhishek ChadhaPosted May 17, 2024, 5:00 AM
To export HTML table data to an Excel file with the
.xlsxextension (compatible with newer versions of Excel), you'll need to use a JavaScript library that supports creating Excel files with that format. One popular library for this purpose is SheetJS. Here's how you can modify your code to use SheetJS for exporting:.xlsxextension:Replace
'your-table-id'with the ID of your HTML table, and'filename.xlsx'with the desired name for the Excel file.With this code, SheetJS will convert your HTML table to an Excel file with the
.xlsxextension, which should be compatible with newer versions of Excel.