title: How to wait for an HTTPrequest response
body: <p>I have a function that request for an URL and if i use that function with a return in it the entire html code will be in the cell with the function name request "=testFormula()".
  Why if i use the formula function it will work but if i use the event one it will not work ?</p>
  
  <pre><code>function onEdit(event){
    testCom();
  }
  // This one will trigger automaticaly when you edit any cell in the sheet
  function testCom(){
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    doc.getRange('a1').setValue("Before fetching");
    var response = UrlFetchApp.fetch("http://www.google.com/");
    doc.getRange('a1').setValue(response);
  }
  // Use in a cell "=testFormula()" to run this function
  function testFormula(){
   var response = UrlFetchApp.fetch("http://www.google.com/");
   return response;
  }
  </code></pre>
  
  <p>Thanks in advance</p>