title: How do I create a downloadable excel sheet from an HTML-table?
body: <p>I have a table in HTML, like this:</p>
  
  <pre><code>&lt;table&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;Column1&lt;/th&gt;
     &lt;th&gt;Column2&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;td&gt;Data1&lt;/td&gt;
     &lt;td&gt;Data2&lt;/td&gt;
    &lt;/tr&gt;
   &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I want to download this data in the form of an Excel-sheet. I've tried some "simple" methods of just opening the data in a new window like this:</p>
  
  <pre><code>javascript:window.open('data:application/vnd.ms-excel,'+document.documentElement.innerHTML);
  </code></pre>
  
  <p>But the actual table I want to export has too many lines and it crashes the browser..</p>
  
  <p>Any ideas on how to solve this?</p>
  
  <p>Clarification: I want to do this through a webpage, for examble using a button to trigger a function to create the excel sheet and start downloading it. Like this:</p>
  
  <pre><code>&lt;button onclick="downloadExcelSheet()"&gt;Download the table as an excel sheet&lt;/button&gt;
  </code></pre>