title: Creating 3 worksheets in one workbook (Excel-JS) problem
body: <p>I need a create an one excel file with 3 worksheets. For now I wrote a function which create worksheet and workbook. I have problem because I need write data into workshet in some executed async function. Maybe some code will describe what I have to do.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var Excel = require('exceljs');
  const workbook = new Excel.Workbook({
      useStyles: true
  })
  
  const headers = [
      { header: 'Plik', key: 'path', width: 40 },
      { header: 'Zwierze', key: 'name', width: 12 },
      { header: 'Prawdopodobienstwo(%)', key: 'confidence', width: 24 },
      { header: 'Czas odpowiedzi(s)', key: 'responseTime', width: 20 }
  ];
  workbook.xlsx.writeFile("./excel/Wyniki.xlsx");
  
  setWorkSheet = (name, responses, filename) =&gt; {
      workbook.xlsx.readFile(filename)
          .then(function () {
              const worksheet = workbook.addWorksheet(name);
              worksheet.columns = headers;
              for (let i = 0; i &lt; responses.length; i++) {
                  worksheet.addRow(responses[i]);
              }
              worksheet.getRow(1).style.font = { size: 12, name: 'Bahnschrift SemiBold SemiConden' }
              worksheet.getRow(1).eachCell((cell) =&gt; {
                  cell.fill = {
                      type: 'pattern',
                      pattern: 'solid',
                      fgColor: { argb: '993399' }
                  },
                      cell.style.font = {
                          color: {
                              argb: 'ffffff'
                          },
                          size: 14,
                      }
              })
              worksheet.eachRow((Row, rowNumber) =&gt; {
                  Row.alignment = {
                      horizontal: 'center',
                  }
                  Row.eachCell((Cell, cellNumber) =&gt; {
                      Cell.alignment = {
                          vertical: 'middle',
                          horizontal: 'center'
                      },
                          Cell.border = {
                              top: { style: 'double', color: { argb: 'black' } },
                              left: { style: 'double', color: { argb: 'black' } },
                              bottom: { style: 'double', color: { argb: 'black' } },
                              right: { style: 'double', color: { argb: 'black' } }
                          }
                  })
              })
              worksheet.views = [
                  { state: 'frozen', xSplit: 1, ySplit: 1, activeCell: 'B2' },
              ];
              return workbook.xlsx.writeFile(`${filename}`)
          })
          .then(function () {
              console.log("Done");
          })
          .catch(function (err) {
              console.log(err)
          });
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this function for now create a new file with special defined name worksheet. I need execute this function 3 times and after this operations I need to have one file and 3 worksheets. Here are places where I executed this function:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>async function Cognitive() {
      let tab = [];
      for (let i = 0; i &lt; arrayOfFiles.length; i++) {
          let x = await cognitive.cognitiveDetectLabels(arrayOfFiles[i]);
          tab.push(x)
      }
  
      setWorkSheet('Cognitive', tab, "./excel/Wyniki.xlsx");
    
  }
  exports.Cognitive = Cognitive;
  
  async function Rekognition() {
      let tab = [];
      const path = "./csv/Rekognition.csv";
  
      for (let i = 0; i &lt; arrayOfFiles.length; i++) {
          let x = await rekognitionFile.callaws(arrayOfFiles[i]);
          tab.push(x)
      }
      setWorkSheet("Rekognition", tab, "./excel/Wyniki.xlsx");
  
  }
  exports.Rekognition = Rekognition;
  
  async function Vision() {
      let tab = [];
      for (let i = 0; i &lt; arrayOfFiles.length; i++) {
          let x = await vision.callVision(arrayOfFiles[i]);
          tab.push(x)
      }
     
      setWorkSheet("Vision", tab, "./excel/Wyniki.xlsx");
  }
  exports.Vision = Vision;</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I execute one of this async function. File with worksheet always is overwritten. 
  However, I need to add sheets to one file (3 sheets). Anyone have some ideas about this problem ? Thank you</p>