For a long time I've used a PHP enabled template to export channel data to a Microsoft Excel spreadsheet and it's worked very well. Recently, I've discovered that since everyone has now upgraded their Excel and the default extension is now XLSX instead of XLS, an alert is displayed when opening the file. If you click proceed anyway you can still open the spreadsheet but if possible I'd like to now export to XLSX instead of XLS as to avoid this alert message. Please find an example of the alert I'm talking about below:
In my export template I have 'Allow PHP' set to 'Yes' and 'PHP Parsing Stage' set to 'Output'. The template contains a basic HTML table that is setup to output the channel data I want in my spreadsheet and below is the PHP I have at the top of this template that generates the Excel file:
<?php header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=My-Channel-Data Spreadsheet.xls"); header("Pragma: no-cache"); header("Expires: 0"); ?>
Does anyone know of a way to adjust the code above so that the spreadsheet is exported as a modern Excel file using the XLSX extension? Any tips or suggestions to achieve this would be greatly appreciated, Thanks!