Ignore same-thread emails that have different labels
I am writing the Date and Subject from specific new emails to a new row of a Google Sheet. I apply a label to the new mail items with a filter. the script processes those labeled emails the label is removed A new label is applied, so that these emails won't be processed next time. Problem : When there is a myLabel email, the script processes all emails in the same thread (eg same subject and sender) regardless of their label (even Inbox and Trash). Question : How to only process new emails i.e. ones with the label myLabel - even when the thread of those messages extends outside the myLabel