Here's a little Excel-file writer in PHP; Excel will read these files, but this library won't:
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<?php echo '<?mso-application progid="Excel.Sheet"?>'; ?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Worksheet ss:Name="Sheet1">
<?php $data = array(array(4,5,6),array("dude","whatever","m<om")); ?>
<Table>
<?php foreach($data as $row): ?>
<Row>
<?php foreach($row as $cell): ?>
<Cell>
<Data ss:Type="String"><?= htmlentities($cell) ?></Data>
</Cell>
<?php endforeach; ?>
</Row>
<?php endforeach; ?>
</Table>
</Worksheet>
</Workbook>
They're "technically" Microsoft Office XML-format[1], and not "Excel files", but users don't tend to be amused by programmers being technically right so I tend not to argue about that sort of thing. I only bring it up here in case someone wants to search for a specification on it.[1]: https://en.wikipedia.org/wiki/Microsoft_Office_XML_formats