function main() {
removeExcludelocation();
}
function removeExcludelocation() {
var campaignIterator = AdsApp.campaigns().get();
Logger.log('Total campaigns found : ' +
campaignIterator.totalNumEntities());
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
Logger.log(campaign.getName());
var locationIterator = campaign.targeting().excludedLocations().get();
var ids = [9013072,9013073];
while (locationIterator.hasNext()) {
var excludedLocation = locationIterator.next();
Logger.log('Location id: ' + excludedLocation.getId().toFixed(0) +
', ZIP Code: ' + excludedLocation.getName() + ', Country code: ' +
excludedLocation.getCountryCode());
if (ids.indexOf(excludedLocation.getId()) != -1) {
excludedLocation.remove();
}
}
}
}