title: Getting Permission error with searchfiles
body: <p>I am getting "You do not have permission to call searchFiles (line 2)." in the code below. When I test run in the editor there is no error. But when I use it in the sheet I get the error. How do I get the permission?</p>
  
  <pre><code>function deleteDocByName(fileName){
      var docs=DriveApp.searchFiles('title contains fileName')
      for(n=0;n&lt;docs.length;++n){
          if(docs[n].getName() == fileName){
              var ID = docs[n].getId()
              DriveApp.getFileById(ID).setTrashed(true)
          }
      }
  }
  </code></pre>