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

207
Visualizações
how to skip particular columns while exporting html table as excel using javascript

i have an html table,where am trying to export the table as excel sheet on button click, my table code is like below:

<table id="basic-datatable" class="table dt-responsive nowrap">
  <thead class="bg-dark">
    <tr>
      <th>#</th>
      <th>Date</th>
      <th> Party Name </th>
      <th>Quotation Number</th>
      <th>Action</th>

    </tr>
  </thead>


  <tbody>


    <tr>
      <td>somedata</td>
      <td>somedate</td>
      <td>somedata</td>
      <td>somedata</td>

      <td> <a href="<?" class="btn btn-info">view</a> </td>
      <td> <a href="" class="btn btn-warning">edit</a> </td>

    </tr>


  </tbody>
</table>

now i have done the following code to ezport the table as excel,

  $(document).ready(function(){
    $("#btnExport").click(function() {
        let table = document.getElementsByTagName("table");
        TableToExcel.convert(table[0], { 
           name: `export.xlsx`, 
           sheet: {
              name: 'Sheet 1' 
           }
        });
    });
});
  <button id="btnExport" class="btn btn-primary btn-icon-text btn-rounded"><i class="ti-clipboard btn-icon-prepend"></i>EXCEL EXPORT</button>
    

here the issue is the last tow columns edit and view are also coming in excel which i dont want, can anyone please tell me how to get rid of it, thanks in advance

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could assign each element you want to remove with a class, like no-export. Then whenever you want to export, create a clone and remove anything with the no-export class. This fiddle should give you a good idea of how to do this.

https://jsfiddle.net/9wr2sc8g/1/

about 4 years ago · Juan Pablo Isaza Relatório
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