“Exportar a Excel en el botón Haga clic en JavaScript” Código de respuesta

Exportar a Excel en el botón Haga clic en JavaScript

<script src="https://cdn.jsdelivr.net/gh/linways/[email protected]/dist/tableToExcel.js"></script>
Selfish Scarab

Exportar a Excel en el botón Haga clic en JavaScript

<button id="btnExport" onclick="exportReportToExcel(this)">EXPORT REPORT</button>

function exportReportToExcel() {
  let table = document.getElementsByTagName("table"); // you can use document.getElementById('tableId') as well by providing id to the table tag
  TableToExcel.convert(table[0], { // html code may contain multiple tables so here we are refering to 1st table tag
    name: `export.xlsx`, // fileName you could use any name
    sheet: {
      name: 'Sheet 1' // sheetName
    }
  });
}
Selfish Scarab

Respuestas similares a “Exportar a Excel en el botón Haga clic en JavaScript”

Preguntas similares a “Exportar a Excel en el botón Haga clic en JavaScript”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código