I can only convert to .xls or .pdf but I need .xlsx . The simpler the code, the better.
------ Example requested ------
I use the Salesforce platform, it has some changes in relation to the html but I managed to adapt perfectly, without any problem.
<!--IMPORTAÇÕES NECESSÁRIAS-->
TODAS IMPORTAÇÕES SÃO ENCONTRADAS NO SITE DO COMPONENTE
https://www.travismclarke.com/tableexport/ -->
<apex:includeScript
'value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
<apex:includeScript value="{!$Resource.xlsxcoremin}"/>
<apex:includeScript value="{!$Resource.Export2ExcelJS}"/>
<apex:includeScript value="{!$Resource.TableExportJS}"/>
<apex:includeScript value="{!$Resource.TableExport2JS}"/>
<apex:includeScript value="{!$Resource.FileSaverJS}"/>'
'<table id="tabela" style="width:100%">
<tr>
<th>CABEÇALHO</th>
</tr>
<tr>
<apex:repeat value="{!registro}" var="reg">
<td><apex:outputText value="{!reg.Name}"/></td>
<td><apex:outputText value="{!reg.Complemento__c}"/></td>
<td><apex:outputText value="{!reg.Data__c}"></apex:outputText></td>
<td><apex:outputText value="{!reg.Banco__c}"></apex:outputText></td>
</apex:repeat>
</tr>
</table>
<input id="clickMe" type="button" value="clickme" onclick="exibeOpcs();" />
'
'function exibeOpcs(){
$("#tabela").tableExport({
headings: true,
footers: true,
formats: ["txt", "xlsx"],
fileName: "Planilha",
});
}'