Deleting all Filters

// function to delete all filters

function deleteAllFilters() {

var sheet = SpreadsheetApp.openById(SSID).getSheetByName('Filters'); sheet.clear();

var response =

Gmail.Users.Settings.Filters.list('me')

for (var i = 0; i < response.filter.length; i++) {

var filter = response.filter[i];

sheet.appendRow([i, "deleting ", filter.id, filter.criteria]); Gmail.Users.Settings.Filters.remove('me', filter.id) Logger.log(JSON.stringify(filter));

}

}