Whole code CTRL+C and go to the editor and press CTRL + A after CTRL+V
function main() {
getAllCampaigns();
}
function getAllCampaigns() {
// AdsApp.campaigns() will return all campaigns that are not removed by
// default.
var campaignIterator = AdsApp.campaigns().get();
Logger.log('Total campaigns found : ' +
campaignIterator.totalNumEntities());
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
Logger.log(campaign.getName());
// Exclude Tennessee, United States (location id = 21175) See
// https://developers.google.com/adwords/api/docs/appendix/geotargeting
// for list of all supported geo codes.
// You could pass either the location code, or a TargetedLocation or
// ExcludedLocation object from an existing campaign.
var zipcode_ides =[9013072,9013073,9013074];
//var tennessee_id = 21175;
zipcode_ides.forEach(function(val){
Logger.log(val);
campaign.excludeLocation(val);
//var sushil = campaign.excludeLocation(val);
// Logger.log(sushil);
});
}
}
After you will see the output like this