title: Node XLSX for write excel file
body: <p>I'm trying to use exceljs to create a excel file of mongodb collection.
  This is what i'm trying to do 
  This is my mongodb collecton</p>
  
  <pre><code>{
    "id": "01",
    "make": "toyota",
    "year": [
      2005,
      2006,
      2007,
      2008,
      2009,
      2010
     ],
    "model": "fortuner",
    "type": "a"
  } 
  {
  
  "id": "02",
  "make": "toyota",
  "year": [
      2005,
      2006,
      2007,
      2008,
      2009,
      2010
     ],
  "model": "land cruiser 200",
  "type": "b"
  } 
  
  {
  "id": "03",
  "make": "toyota",
  "year": [
      2005,
      2006,
      2007,
      2008,
      2009,
      2010
  ],
  "model": "land cruiser 200",
  "type": "e"
  }
  </code></pre>
  
  <p>,and i want to create excel file from this collection</p>
  
  <p>ID Make    Year      Model  Type</p>
  
  <p>01 toyota  2005-2010  a      xxxx</p>
  
  <p>02 nissan  2000-2006  b      xxxx</p>
  
  <p>In XLSX official documentation they said to use </p>
  
  <p>Writing Workbooks</p>
  
  <p>nodejs write to file:</p>
  
  <pre><code>/* output format determined by filename */
  XLSX.writeFile(workbook, 'out.xlsx');
  /* at this point, out.xlsx is a file that you can distribute */
  write to binary string (using FileSaver.js):
  /* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */
  var wopts = { bookType:'xlsx', bookSST:false, type:'binary' };
  
  var wbout = XLSX.write(workbook,wopts);
  
  function s2ab(s) {
   var buf = new ArrayBuffer(s.length);
   var view = new Uint8Array(buf);
   for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) &amp; 0xFF;
   return buf;
  }
  
  /* the saveAs call downloads a file on the local machine */
  saveAs(new Blob([s2ab(wbout)],{type:""}), "test.xlsx")
  </code></pre>
  
  <p>i can't get good idea about how to use this.
  Does anyone know how to do this ?</p>