title: How to save .xlsx data to file as a blob
body: <p>I have a similar question to this question(<a href="https://stackoverflow.com/q/23301467/2197555">Javascript: Exporting large text/csv file crashes Google Chrome</a>):</p>
  
  <p>I am trying to save the data created by <em>excelbuilder.js</em>'s <code>EB.createFile()</code> function. If I put the file data as the <code>href</code> attribute value of a link, it works. However, when data is big, it crashes Chrome browser. Codes are like this: </p>
  
  <pre><code>//generate a temp &lt;a /&gt; tag
  var link = document.createElement("a");
  link.href = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + encodeURIComponent(data);
  link.style = "visibility:hidden";
  link.download = fileName;
  
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
  </code></pre>
  
  <p>My codes to create the data using excelbuilder.js is like follows: </p>
  
  <pre><code>var artistWorkbook = EB.createWorkbook();
  var albumList = artistWorkbook.createWorksheet({name: 'Album List'});
  
  albumList.setData(originalData); 
  
  artistWorkbook.addWorksheet(albumList);
  
  var data = EB.createFile(artistWorkbook);
  </code></pre>
  
  <p>As suggested by the answer of the similar question (<a href="https://stackoverflow.com/q/23301467/2197555">Javascript: Exporting large text/csv file crashes Google Chrome</a>), a blob needs to be created. </p>
  
  <p>My problem is, what is saved in the file isn't a valid Excel file that can be opened by Excel. The codes that I use to save the <code>blob</code> is like this: </p>
  
  <pre><code>var blob = new Blob(
      [data],
      {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"}
  );
  
  // Programatically create a link and click it:
  var a = document.createElement("a");
  a.href = URL.createObjectURL(blob);
  a.download = fileName;
  a.click();
  </code></pre>
  
  <p>If I replace the <code>[data]</code> in the above codes with <code>[Base64.decode(data)]</code>, the contents in the file saved looks more like the expected excel data, but still cannot be opened by Excel. </p>
  
  <p>Thanks!</p>