title: Excel JS API: write, calculate and load values from cells with custom functions
body: <p>The intention is to write the formula (custom function) to the cell, <em>calculate it</em>, load values and retrieve them in a single function. </p>
  
  <pre><code>function myFunc() {
      Excel.run(function (ctx) {
          var fExcel = '=SUM(1,2)';
          var fCustom = '=custFunc()';
  
          var rng = ctx.workbook.worksheets.getActiveWorksheet().getRange('A1');
  
          //rng.formulas = [[fExcel]]; // works OK          
          rng.formulas = [[fCustom]]; // values are #GETTING_DATA
  
          // try different calc calls
  
          rng.load("values");
  
          return ctx.sync().then(function () {
              console.log(rng.values);
          });
      });
  }
  </code></pre>
  
  <p>For built-in Excel functions, everything works as expected and <code>console</code> logs a value 3 after <code>ctx.sync()</code>. With custom functions (that send a request to the external server to compute the result) the values are <code>'#GETTING_DATA'</code>. I've tried all the following things before <code>rng.load("values");</code> to trigger the calculation, but nothing have worked so far:</p>
  
  <ul>
  <li><p><code>rng.calculate();</code></p></li>
  <li><p><code>var s = ctx.workbook.worksheets.getActiveWorksheet(); 
  s.calculate(true);</code></p></li>
  <li><p><code>ctx.workbook.application.calculate('Full');</code></p></li>
  </ul>
  
  <p>Is there a way to trigger the calculation of custom functions and make sure that the values are available after the <code>ctx.sync()</code>?</p>