title: Can't download files from Google Drive using GAS
body: <p>I have been using a simple Google Apps Script code to download a file from my Google Drive to my local computer.</p>
  <pre><code>var dlUrl = &quot;https://drive.google.com/uc?export=download&amp;id=&quot; + file.getId();
  
    // Open a dialog and run Javascript for downloading the file.
    var str = '&lt;script&gt;window.location.href=&quot;' + dlUrl + '&quot;&lt;/script&gt;';
    var html = HtmlService.createHtmlOutput(str);
    SpreadsheetApp.getUi().showModalDialog(html, &quot;Downloading invoice ... please wait&quot;);
  
    // This is used for closing the dialog.
    Utilities.sleep(3000);
    file.setTrashed(true);
    var closeHtml = HtmlService.createHtmlOutput(&quot;&lt;script&gt;google.script.host.close()&lt;/script&gt;&quot;);
    SpreadsheetApp.getUi().showModalDialog(closeHtml, &quot;Downloading invoice ... please wait&quot;);
  </code></pre>
  <p>This code has been working for over a year and then suddenly stopped working a few days ago with no changes to the code.  When I run it, I now get the message: &quot;403.  That's an error.  We're sorry, but you do not have access to this page. That's all we know.&quot;</p>
  <p>I know the file exists and can be accessed because if I take the string in dlUrl and put it in the address bar of my browser, the file downloads without trouble.</p>
  <p>I have also:</p>
  <ul>
  <li>Signed out of all other Google accounts, and have signed in only to the account that owns the file.</li>
  <li>Removed all saved passwords to the account</li>
  <li>Attempted to change the file permissions to universal EDIT permissions</li>
  </ul>
  <p>While I do tinker with Google Apps Script, I consider myself a beginner still and would appreciate any suggestions on what I should try.  Thank you very much for your help.</p>