title: Excel script run from Power Automate. Formula doesn't update
body: <p>Power Automate runs the script every day (08:00).
  In this script I compare the current date with another date (column C). This check is done by the formula. The result is placed in column D. The final check is to put information into the array only if the number (Column D) is &lt;=24.</p>
  <p>The problem is that when <strong>Power Automate runs the script the formula doesn't update column D</strong>.
  If I open the workbook the formula is updated and the script works.</p>
  <p><strong>Example Sheet:</strong></p>
  <p><a href="https://i.stack.imgur.com/vVpDn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vVpDn.png" alt="enter image description here" /></a></p>
  <p>In <strong>column D</strong> there is this formula (cell D2) <code>=D2-$E$2</code> and so on.
  In the <strong>column E2</strong> there is the current date with formula <code>=today()</code></p>
  <p><strong>Example code:</strong></p>
  <pre><code>function main(workbook: ExcelScript.Workbook) {
  
    //first step. update formula
     workbook.getApplication().calculate(ExcelScript.CalculationType.full);
  
    // Get the &quot;MyWorksheet&quot; worksheet from the workbook.
    let selectedSheet = workbook.getWorksheet(&quot;MyWorksheet&quot;);
    let range = selectedSheet.getUsedRange();
    let rangeValues = range.getValues();
  
    const arr= [];
  
    for(let i=0; i&lt; rangeValues.length; i++){
        
        //compare the number (column D)
        if(rangeValues[i][3]&lt;=24){
          arr.push(rangeValues[i][0]);
        }
    }  
  }
  </code></pre>
  <p>Where am I wrong?</p>
  <p>I tried with manual and automatic calculation mode but without result.</p>
  <p>To temporarily solve the problem, decrease the value in column D by 1 every day without using the formula.</p>