title: Exporting HTML table to Excel without hidden <td>tag
body: <p>In my web application, I have an HTML table that shows some data to the user.</p>
  <p>Here I want to export it to excel and I found a jQuery code to do that.</p>
  <p>But the thing is it's also export the data that I hide from the table.</p>
  <p>Is there any way to export the table without the <code> &lt;td style=&quot;display:none;&quot;&gt; @Html.DisplayFor(modelItem =&gt; item.Id) &lt;/td&gt;</code></p>
  <p>This is the table</p>
  <pre><code> &lt;table id=&quot;tblParts&quot; class=&quot;table table-striped&quot;&gt;
     &lt;thead&gt;
       &lt;tr&gt;
         &lt;th&gt; Part Number &lt;/th&gt;
         &lt;th&gt; Description &lt;/th&gt;
         &lt;th&gt; Model &lt;/th&gt;
         &lt;th&gt; Order Qty &lt;/th&gt;
         &lt;th&gt;&lt;/th&gt;
       &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt; @foreach (var item in Model.OrderBy(i =&gt; i.PartNumber)) { &lt;tr&gt;
         &lt;td style=&quot;display:none;&quot;&gt; @Html.DisplayFor(modelItem =&gt; item.Id) &lt;/td&gt;
         &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.PartNumber) &lt;/td&gt;
         &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.Description) &lt;/td&gt;
         &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.Model) &lt;/td&gt;
         &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.OrderQty) &lt;/td&gt;
       &lt;/tr&gt; } &lt;/tbody&gt;
   &lt;/table&gt;
  </code></pre>
  <p>This is the Jquery.</p>
  <pre><code>function ExportToExcel(type, fn, dl) {
    var elt = document.getElementById('tblParts');
    var wb = XLSX.utils.table_to_book(elt, {
      sheet: &quot;sheet1&quot;
    });
    return dl ?
      XLSX.write(wb, {
        bookType: type,
        bookSST: true,
        type: 'base64'
      }) :
      XLSX.writeFile(wb, fn || ('Order.' + (type || 'xlsx')));
  }
  
  </code></pre>