I have been using this technique for years to generate Excel spreadsheets from a php program.
At the beginning of the php is this code:
header("Content-type: application/vnd.ms-excel; charset=UTF-8");
$fn = "excel" . date('Y-m-d_h_i') . ".xls";
header("Content-Disposition: attachment; filename=" . $fn);
Then I build an old fashioned HTML table with rows & columns that become the rows & columns of the spreadsheet.
If I change the line: $fn = "excel" . date('Y-m-d_h_i') . ".xls"; to $fn = "excel" . date('Y-m-d_h_i') . ".xlsx";,
will that cause it to generate an xlsx file compatible with current Excel?
Or is there a better way?