Gmail – How to remove multiple Gmail labels

gmailgmail-labels

I have imported old emails from Outlook backups in my Gmail account and I ended up with 1000+ labels in my system. Is there an easy massive way to remove them and keep only ~10 my usual ones?

Best Answer

I wrote a script to add to Google Scripts.

function removeLabel() {

    var labels = [];
    labels = GmailApp.getUserLabels();

    //Loop through all Labels
    for (var i = 0; i < labels.length; i++) {
        if (labels[i].getName().indexOf("WORD TO FIND IN LABEL NAME") > -1) {
            //If the WORD is found in label name - delete the label
            labels[i].deleteLabel();
        }
    }
}