Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
Extract HTML table in another html file

I wanna get way to download(EXPORT) HTML table in another HTML file..

for example I'm now in index.html but i have another file with name of table.html that contains the table that i wanna print..

basically..

When i LOAD index.html start downloading TABLE in table.html

i tried this, but didn't work..

INDEX.HTML

<!DOCTYPE html>
<html>
  <script src="http://www.w3schools.com/lib/w3data.js"></script>
  <script src="./dist/exportToExcel.js"></script>

  <body>
    <div w3-include-html="./table.html"></div>

    <script>
      w3IncludeHTML();

      function printEXCEL(type, fn, dl) {
        var elt = document.getElementById("tbl_exporttable_to_xls");
        var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
        return dl
          ? XLSX.write(wb, { bookType: type, bookSST: true, type: "base64" })
          : XLSX.writeFile(wb, fn || "MySheetName." + (type || "xlsx"));
      }

      printEXCEL("xlsx");
    </script>
  </body>
</html>

TABLE.HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./dist/exportToExcel.js"></script>
  </head>
  <body>
    <table id="tbl_exporttable_to_xls" border="1">
      <thead>
        <th>Sr</th>
        <th>Name</th>
        <th>Location</th>
        <th>Job Profile</th>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td><p>کوردی</p></td>
          <td>فۆنت</td>
          <td>سڵاو</td>
        </tr>
        <tr>
          <td>2</td>
          <td><p>Sagar Gada</p></td>
          <td>California</td>
          <td>Sr FullStack Dev</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda