I can use .xls files perfect, but not .xlsx.
XLS files and XLSX files are two different formats. Excel cannot open an XLS files with a wrong extension .xlsx
and it cannot open an XLSX file with the wrong extension .xls
.
XLS is a proprietary binary format, while XLSX is an opened format based on XML files stored in a ZIP archive (just like LibreOffice).
If Excel does open the XLS file, then the file is XLS encoded. So if you client specification is for XLSX then you have to change your code.
As your code is in PHP, of course I suggest TBS + OpenTBS. It works with the technical of templates.