AdWords Script to Set Radius Targeting in Bulk

AdWords Editor does actually support proximity targets where you set the radius targeting of your campaigns via uploading the longitude and altitude in a specific format. However, a common issue that you might face when adding your location targets in bulk is “Unresolved Location” where editor doesn’t recognize the areas’ addresses. This might result in failing the completion of importing all location targets.

On the other side, AdWords scripts are more powerful in creating proximity targeting where most target points go through without any errors as long as all info is accurate. Moreover, you can automate the process of updating your radius targeting through scheduling the script to run on a frequent basis based on your needs.

Accordingly, we’ve written a simple AdWords script that connects to Google sheets where you provide campaigns names and the necessary location arguments ( Latitude, Longitude, Radius, Radius Unit).


radius targeting location script


#Latitude: The latitude of the central point.
#Longitude: The longitude of the central point.
#Radius: The radius of the proximity target.
#Radius Units: The units of the radius, either “MILES” or “KILOMETERS”.

After you create and fill your sheet with all the details, it’s time now to add the spreadsheet URL in the script source and run it.

* Radius Targeting Script
* Version 1.0
* Created By: Ahmed Ali
function main() {
  var SPREADSHEET_URL = "INsert your spreadsheet URL here";
  var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
  var sheet = spreadsheet.getActiveSheet();
  var data = sheet.getRange("A:E").getValues();
  for (i in data) {
  if (i == 0) {
  continue;  }

 var [CampaignName, latitude, longitude, raduis, unit] = data[i];

 if (CampaignName == "") {
  else {

  var campaignIterator = AdWordsApp.campaigns()
  .withCondition("CampaignName CONTAINS_IGNORE_CASE '" + CampaignName +"'")
  while (campaignIterator.hasNext()) {
  var campaign =;
 campaign.addProximity(latitude, longitude, raduis, unit);
Ahmed launched his first digital campaign in 2013 through participating in Google Online Marketing Challenge. He competed with over 12,000 students from 80 countries to win the first place in Africa & MENA region and one of the best five campaigns in the world. Today, he works as an Associate Digital Director at Keyade Middle East.

One Comment

  1. This is awesome. One note, I tried running the script using the link from the 7th or 8th tab in a Google doc and the script ran, but didn’t make any changes. I made a brand Google doc and put everything on the first sheet and it worked perfectly!

Leave a Reply

Your email address will not be published. Required fields are marked *