title: Exclude Specific Columns when exporting data from HTML table to excel
body: <p>I am using this script for exporting data from HTML table to Excel.</p>
  
  <pre><code>    &lt;script&gt;
  var tableToExcel = (function() {
    var uri = 'data:application/vnd.ms-excel;base64,'
      , template = '&lt;html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"&gt;&lt;head&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;&lt;x:ExcelWorkbook&gt;&lt;x:ExcelWorksheets&gt;&lt;x:ExcelWorksheet&gt;&lt;x:Name&gt;{worksheet}&lt;/x:Name&gt;&lt;x:WorksheetOptions&gt;&lt;x:DisplayGridlines/&gt;&lt;/x:WorksheetOptions&gt;&lt;/x:ExcelWorksheet&gt;&lt;/x:ExcelWorksheets&gt;&lt;/x:ExcelWorkbook&gt;&lt;/xml&gt;&lt;![endif]--&gt;&lt;/head&gt;&lt;body&gt;&lt;table&gt;{table}&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;'
      , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
      , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
    return function(table, name) {
      if (!table.nodeType) table = document.getElementById(table)
      var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
      window.location.href = uri + base64(format(template, ctx))
    }
  })()
      &lt;/script&gt;
  </code></pre>
  
  <p>I found this <a href="https://gist.github.com/insin/1031969" rel="nofollow">here</a>
  but when i export this data it includes all columns in HTML table as expected to do. but my last row contains some icons that i don't want to export to excel.</p>
  
  <pre><code>&lt;div class="row" style="margin-left:20px;"&gt;
      &lt;div class="grid_4"&gt;
          &lt;div class="da-panel collapsible"&gt;
          &lt;input type="button" class="btn btn-success" onclick="tableToExcel('testTable', 'W3C Example Table')" value="Export to Excel" style="float:right"&gt;
              &lt;div class="da-panel-content"&gt;
  
              &lt;div class="da-panel-title" style="border-top:1px solid #ccc;border-bottom:1px solid #ccc"&gt;
              &lt;h3 style="padding-left:10px;font-weight:bold;"&gt;Staff Training Information&lt;/h3&gt;&lt;/div&gt;
  
           &lt;table  class="da-table da-ex-datatable-numberpaging" id="testTable" width="100%"&gt;
            &lt;thead width="100%"&gt;
              &lt;tr&gt;
              &lt;th width="10%"&gt;Staff ID&lt;/th&gt;
                &lt;th width="10%"&gt;Name&lt;/th&gt;
                &lt;th width="10%"&gt;Location&lt;/th&gt;
                &lt;th width="10%"&gt;POCT Test&lt;/th&gt;
                &lt;th width="10%"&gt;Initial Training Date&lt;/th&gt;
                &lt;th width="10%"&gt;Annual Competency Date&lt;/th&gt;
                &lt;th width="10%"&gt;Competency Type&lt;/th&gt;
                &lt;th width="1%"&gt;Next Competency Date&lt;/th&gt;
                &lt;th width="39%"&gt;Action&lt;/th&gt;
              &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody width="100%"&gt;
            &lt;?php 
             include_once('database.php');
             $pdo = Database::connect();
             $sql = 'SELECT * FROM competency';
  
             foreach ($pdo-&gt;query($sql) as $row) {
                      $id = $row['staff_id'];
                      echo '&lt;tr&gt;';
                          echo '&lt;td width="10%"&gt;'. $row['staff_id'] . '&lt;/td&gt;';
                          $sql1 = "SELECT *FROM staff WHERE StaffID='$id'";
                          foreach($pdo-&gt;query($sql1) as $res)
                          {
                              echo '&lt;td width="10%"&gt;'. $res['StaffName'] . '&lt;/td&gt;';
                          }
                      echo '&lt;td width="10%"&gt;'. $row['location'] . '&lt;/td&gt;';
                      ?&gt;
                          &lt;td width="10%"&gt;
                          &lt;?php
                               $s = $row['poct_test'];
                               $val = explode(" ",$s);
                               for ($i=0; $i&lt;sizeof($val); $i++)
                               {
                                   $v = $val[$i];
                                   echo $v."&lt;br/&gt;";
                               }
                          ?&gt;
                          &lt;/td&gt;
                  &lt;?php
                      echo '&lt;td width="10%"&gt;'. $row['date_of_initial_training'] . '&lt;/td&gt;';
  
                          echo '&lt;td width="10%"&gt;'. $row['annual_competency'] . '&lt;/td&gt;';
                              echo '&lt;td width="10%"&gt;'. $row['type_of_competency'] . '&lt;/td&gt;';
                                  echo '&lt;td width="1%"&gt;'. $row['next_competency'] . '&lt;/td&gt;';
  
                                          echo '&lt;td width="39%"&gt;';
                          echo '&lt;a href="viewtrainingdetails.php?id='.$row['id'].'"&gt;&lt;img src="images/ic_zoom.png" height="16" width="16" /&gt;&lt;/a&gt;';
                          echo ' ';
                          echo '&lt;a href="updatetraining.php?id='.$row['id'].'"&gt;&lt;img src="images/icn_edit.png"/&gt;&lt;/a&gt;';
  
                          echo ' ';
                  ?&gt;
                  &lt;a href="javascript:DeleteRecord('&lt;?php echo $row['id'];?&gt;')"&gt;&lt;img src="images/icn_logout.png"/&gt;&lt;/a&gt;
                  &lt;?php
                          echo '&lt;/td&gt;';
                      echo '&lt;/tr&gt;';
             }
             Database::disconnect();
            ?&gt;
            &lt;/tbody&gt;
      &lt;/table&gt;
          &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>As shown in code that last 3 echo contains update/delete icons. I just want to exclude Action column when exporting the table content in excel.
  Any help would be highly appreciated. </p>