I desperately try to find a way to remove the system label "Inbox" from emails that have another label (e.g. News) already assigned.

My idea behind is to have incoming messages first in the inbox and automatically labelled and secondly removed from the inbox but still labelled after a certain time point.

How can I make it conditional using:

function removeLabel (){for (var i = 0; i < labels.length; i++) {
    if (labels[i].getName().indexOf("Inbox") > -1) {
        //If the WORD is found in label name - delete the label

closed as unclear what you're asking by Rubén, user0, jonsca Jul 6 at 23:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It's not clear what is this question about. Are you using Google Apps Script or the Gmail API? – Rubén Jul 6 at 16:50