Google Ads 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 the 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 by 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 campaign 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);


  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!

  2. This is an absolute lifesaver. Had to setup 140 office locations with 10km radius targeting and this worked a treat, thank you!

  3. This is saving me TONS of time! Thank you so much for developing this script. I can’t believe it’s not native to Google Ads interface – especially after they updated it recently.

  4. Hello Ahmed,

    I want to change the heading 2 based on radius location? Is there any script related to this?
    eg: If someone is near by restaurant within 2 km, then he will get heading 2 as “reach us within 2 mins”.

  5. I’m not seeing the locations update in my campaign when I run the script – is that right? My locations in the campaign are still empty.

  6. I keep getting the “Invalid argument: latitude. Should be of type: number (file, line 22)”. What am I doing wrong?