title: How can I make an alert appear after calling DriveApp in Google Apps Script?
body: <p>I'm trying to show an alert using Apps Script, but I can't make an alert show up after I've called DriveApp. This code demonstrates the problem. What do I need to do to make the second alert appear?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function onOpen(e) {
    // apps script function called on opening of google spreadsheet
    var ui = SpreadsheetApp.getUi();
    var spreadsheetId = SpreadsheetApp.getActiveSpreadsheet().getId();
    ui.alert("Before DriveApp"); // this alert appears
    var spreadsheetFile = DriveApp.getFileById(spreadsheetId);
    ui.alert("After DriveApp"); // this alert does not appear
  }</code></pre>
  </div>
  </div>
  </p>