title: Google sheets script returns N/A from a populated cell
body: <p>I have a query that outputs any rows that match a regex statement:</p>
  <pre><code>Query('Sheet 1'!D2:H, &quot;select D where H matches '.*{{([0-9])*}}.*'&quot;)
  </code></pre>
  <p>which is then summarized/condensed in a cell. I then have a script that reads from the summarized cell and emails the cell's content to addresses.</p>
  <pre><code>  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); 
    var sheet = spreadsheet.getSheetByName('Reminders');
    var emails = sheet.getRange(2,2).getValue();
    var subject = sheet.getRange(2,4).getValue();
    var message = sheet.getRange(2,5).getDisplayValue();
    MailApp.sendEmail({to:emails,subject:subject,htmlBody:message});
    
  </code></pre>
  <p>Unfortunately, even though the query returns values on the actual sheet that is not null, the email just sends #N/A. Maybe the query match runs on the backend before the email is sent? Does anyone have solution?</p>