title: Exporting HTML table with correct format in Javascript
body: <p>I have a table and I have there a amount column. I want to export the table with the correct number format because when I do export my table, I only get 100 instead of 100.00. </p>
  
  <p>My table look like this:</p>
  
  <pre><code>ID    Code    Amount    Time
  1      1      100.00    2014-09-22 18:59:25
  1      1      100.60    2014-09-22 18:59:25
  1      1      100.00    2014-09-22 18:59:25
  1      1       12.50    2014-09-22 18:59:25
  </code></pre>
  
  <p>And the Excel output is like this:</p>
  
  <pre><code>ID    Code    Amount    Time
  1      1         100    2014-09-22 18:59:25
  1      1      100.60    2014-09-22 18:59:25
  1      1         100    2014-09-22 18:59:25
  1      1        12.5    2014-09-22 18:59:25
  </code></pre>
  
  <p>This is my code:</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, filename) {
              if (!table.nodeType) table = document.getElementById(table)
              var ctx = {
                  worksheet: name || 'Worksheet',
                  table: table.innerHTML
              }
  
              document.getElementById("dlink").href = uri + base64(format(template, ctx));
              document.getElementById("dlink").download = filename;
              document.getElementById("dlink").click();
  
          }
      })()
      function download(){
          $(document).find('tfoot').remove();
          var name = document.getElementById("name").innerHTML;
          tableToExcel('table2', 'Sheet 1', name+'.xls')
          setTimeout("window.location.reload()",0.0000001);
  
      }
      var btn = document.getElementById("btn");
      btn.addEventListener("click",download);
      &lt;/script&gt;
  </code></pre>
  
  <p>Is there any way to achieve this? I want my Excel file to look exactly like the data in my table.</p>