This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | has:nouserlabels !in:Inbox -label:sent -label:drafts | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * Archive all read emails that have been read and | |
| * it has been 7 days. | |
| * | |
| */ | |
| function archiveInbox() { | |
| // search for threads based on following parameters | |
| var threads = GmailApp.search('label:inbox is:read older_than:7d'); | |
| for(var i=0; i<threads.length; i++) { |