title: cant get cell value in gdoc scripts -> it says #ref! or returns blank
body: <p>Im creating a script for a gdoc spreadsheet that sends an email alert with the value of a cell (estado).</p>
  <p>The code is like this:</p>
  <hr />
  <p>function alerta() {</p>
  <p>var libro=SpreadsheetApp.getActiveSpreadsheet()
  var hoja=libro.getActiveSheet();</p>
  <p>var estado=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(&quot;Alertas&quot;).getRange(&quot;F21&quot;).getValue();
  var destinatario=SpreadsheetApp.getActiveSpreadsheet().getSheetByName(&quot;Alertas&quot;).getRange(&quot;F22&quot;).getValue();</p>
  <p>GmailApp.sendEmail(destinatario,&quot;Subject&quot;,estado)</p>
  <h2>}</h2>
  <p>The cell F21 is the value of an index function on the sheet that, in the spreadsheet, has a value of &quot;ok&quot; or &quot;alert&quot;.
  The cell F22 is the value of a join function on the sheet that, in the spreadsheet, has a value of different emails concatenated by a &quot;,&quot;.</p>
  <p>The point is that the variable &quot;estado&quot;, when I receive the email is #ref! or blank, while the variable &quot;destinatario&quot; works perfect.</p>
  <p>Its driving me crazy!</p>
  <p>Thanks</p>