I needed to return an Excel file from a PHP script I wrote.  The simplest way to do this is to create a page consisting of a single table and then setting the headers correctly.  Excel will read the HTML table and convert it automatically into an excel spreadsheet – much easier than writing out [...]