Hi Liliana,
This could be done by utilizing the
geo performance report. You can extract city IDs from locations that meet the criteria you specified above by querying the geo performance report, storing the relevant IDs in an array, and then
selecting the campaigns that you want to exclude the locations from. Note that to select search campaigns, you can use the standard campaign selector,
AdWordsApp.campaigns().
You can also read exporting a report to a spreadsheet
here.
For example, the query could look like this:
var cityIds = []; // The array that you will push all city IDs to
var report = AdWordsApp.report(
"SELECT CampaignName, CityCriteriaId, CountryCriteriaId, Impressions, Clicks, Cost " +
"FROM GEO_PERFORMANCE_REPORT " +
"DURING LAST_30_DAYS");
var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
var campaignName = row["CampaignName"];
var cityId = row["CityCriteriaId"];
var countryId = row["CountryCriteriaId"];
var impressions = row["Impressions"];
var clicks = row["Clicks"];
var cost = row["Cost"];
cityIds.push(cityId); // Push the current city ID into a cityIds array
}
Then, you can select the campaigns that you want to exclude the location from.
Here is a sample snippet for excluding locations from campaigns.