title: How to export excel sheet with formula using node-excel-export?
body: <p>I am using <a href="https://www.npmjs.com/package/node-excel-export" rel="nofollow noreferrer"><code>node-excel-export</code></a> module in node.js to export my data from DB into excel sheet.</p>
  
  <p>The problem here is that, i want the excel sheet to be shipped with formulae applied on specific cells.</p>
  
  <p>The documentation in the site does not demonstrate the usage of formulae clearly.</p>
  
  <p>This is what i have tried:</p>
  
  <pre><code>var XLSX = require('xlsx');
  
  function getSheet(data, opts) {
      var ws = {};
  
      var range = {
          s: {
              c:0, 
              r:0
          }, 
          e: {
              c:3, 
              r:3 
          }
      };
  
      for(var R = 0; R &lt; 4; R++) {
          for(var C = 0; C &lt; 3; C++) {
  
              var cell = {
                  v: data[R][C] ,
                  t: 'n'
              };
  
              var cell_ref = XLSX.utils.encode_cell({
                  c:C,
                  r:R
              });
  
              if(C == 2) {
                  cell_ref.f = "A"+R+"B"+R;
              }
  
              ws[cell_ref] = cell;
          }
      }
      ws['!ref'] = XLSX.utils.encode_range(range);
      return ws;
  }
  
  
  var data = [
      [1, 2],
      [3, 4],
      [5, 6], 
      [7, 8]
  ];
  
  function Workbook() {
      if(!(this instanceof Workbook)) {
          return new Workbook();
      }
      this.SheetNames = [];
      this.Sheets = {};
  }
  
  var wb = new Workbook();
  var wsName = "SheetJS";
  wb.SheetNames.push(wsName);
  wb.Sheets[wsName] = getSheet(data);
  
  
  module.exports = {
      dataset: [],
      getExcelFile: function (resultset, res) {
  
          /* write file */
          XLSX.writeFile(wb, 'test.xlsx');
  
          res.download('test.xlsx');
      }
  };
  </code></pre>
  
  <p>`</p>
  
  <p>please help. </p>