1

It creates file but when try open file, it prints an error, online browser xlxs viewer cannot open it too.

wb = XLSX.utils.book_new();

titles = ['title','second title'];
answers_list_ = ['answer', 'second answer'];

var ws_data = [
    titles,
    answers_list_
];
var ws_name = "SheetJS";
var ws = XLSX.utils.aoa_to_sheet(ws_data);
XLSX.utils.book_append_sheet(wb, ws, ws_name);


$("#button-a").click(function(e){
    e.preventDefault();
   XLSX.writeFile(wb, 'out.xlsx');
});     
Manoj
  • 1,699
  • 3
  • 6
  • 19
iDonKnow
  • 11
  • 3

1 Answers1

-1

It doesn't make much sense to write to an excel file, it's better to use csv, it's very easy to write, you can use php and js quickly and easily, especially if you don't need to add some styles, the csv file is perfectly opened by all modern programmers for reading tables. For javascript you can check it there for php you can find it there

iDonKnow
  • 11
  • 3