Sounds interesting?

Simply fill out the form and get access to the webinar.

Oops! Something went wrong while submitting the form.
Google Ads

How to automate negative keywords on Google Ads (with and without scripts)

13.2.2025

Automate Negative Keywords on Google Ads With Free Scripts
Google Ads

How to automate negative keywords on Google Ads (with and without scripts)

13.2.2025

Automate Negative Keywords on Google Ads With Free Scripts
Google Ads

How to automate negative keywords on Google Ads (with and without scripts)

13.2.2025
February 13, 2025
Webinar

How to automate negative keywords on Google Ads (with and without scripts)

13.2.2025
February 13, 2025

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Speaker

No items found.

Results

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Playful Linkedin Icon
Playful Mail Icon

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Playful Linkedin Icon
Playful Mail Icon

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Playful Linkedin Icon
Playful Mail Icon

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Playful Linkedin Icon
Playful Mail Icon

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Playful Linkedin Icon
Playful Mail Icon
Written by
Tara Gerashi
Marketing Manager @ Shopstory
Written by
Tara Gerashi
Marketing Manager @ Shopstory
Written by
Tara Gerashi
Blog

How to automate negative keywords on Google Ads (with and without scripts)

One of the biggest headaches in managing Google Ads is the endless task of reviewing search terms and filtering out negative keywords. While we used to have tight control with exact match keywords, Google's recent changes have made things trickier - now your ads can show up for all sorts of "similar" searches that aren't quite what you want.

Going through those search term reports, which often contain thousands of entries, is time-consuming and frankly, frustrating. 

That’s why this guide will walk you through different ways to automate negative keywords, from using Google Ads scripts and API solutions to a no-code approach using Shopstory.

If you’ve been spending too much time tweaking negative keyword lists, this is for you.

Why automate negative keywords?

Manually managing negative keywords is slow, repetitive, and easy to mess up. With automation, you can:

Avoid wasted ad spend: Stop paying for irrelevant clicks
Save hours of manual work: No more combing through search terms every day
Keep campaigns consistent: No missed keywords or mismatched settings
Improve targeting: Show ads to people who actually want what you’re offering

If you’ve ever checked your search term report and thought, Why is my ad showing for that? – automation can help.

1️⃣ Automating negative keywords with Google Ads scripts

Google Ads scripts let you automate campaign management inside your Google Ads account – no extra software or integrations needed.

Step 1: Open Google Ads scripts

1. Log in to Google Ads.
2. Click Tools & Settings > Scripts.
3. Click the "+" button to create a new script.

Step 2: Copy & paste this script

This script will add a set of negative keywords to all your Search campaigns.

If you want to add negative keywords to Shopping or Performance Max campaigns (❗), use a shared negative keyword list instead (see Script 2) or opt for a no-code alternative (see Shopstory).

👉 Replace ["free", "cheap", "download", "torrent", "trial"] with your own negative keywords.

function main() {
  var NEGATIVE_KEYWORDS = ["free", "cheap", "download", "torrent", "trial"];  // ← EDIT THIS LIST

  var campaigns = AdsApp.campaigns().get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < NEGATIVE_KEYWORDS.length; i++) {
      campaign.createNegativeKeyword(NEGATIVE_KEYWORDS[i]);  
    }

    Logger.log("Added negative keywords to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Click Authorize to allow Google Ads to make changes.
2. Click Preview to test it before making changes.
3. Click Run to apply the negative keywords to your campaigns.

What happens next?
This script will automatically add negative keywords to all campaigns, preventing your ads from showing on searches that don’t match your business.

2️⃣ Using a shared negative keyword list (across campaigns)

If you manage multiple campaigns, a shared negative keyword list helps keep everything consistent. Instead of adding negative keywords to each campaign manually, you update one list, and all linked campaigns follow the changes.

Step 1: Create a shared negative keyword list

1. In Google Ads, go to Tools & Settings > Negative Keyword Lists.
2. Click "+" to create a new list (e.g., "Master Negative Keywords").
3. Add your negative keywords to this list.

Step 2: Copy & paste this script

👉 Replace "Master Negative Keywords" with the name of your list.

function main() {
  var NEGATIVE_LIST_NAME = "Master Negative Keywords";  // ← EDIT THIS TO MATCH YOUR LIST NAME

  var negativeKeywordLists = AdsApp.negativeKeywordLists()
    .withCondition("Name = '" + NEGATIVE_LIST_NAME + "'")
    .get();
  
  if (!negativeKeywordLists.hasNext()) {
    Logger.log("Negative keyword list not found.");
    return;
  }
  
  var negativeList = negativeKeywordLists.next();
  var campaigns = AdsApp.campaigns().get();
  
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    campaign.addNegativeKeywordList(negativeList);
    Logger.log("Applied negative keyword list to: " + campaign.getName());
  }
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to apply the list to all campaigns.

Why use a shared list?

  • One place to manage all negative keywords
  • No need to edit scripts when adding new terms
  • Instant updates across all campaigns

3️⃣ Automating negative keywords from Google Sheets

If you prefer managing your negative keywords in a spreadsheet, this script will sync your Google Sheet with Google Ads (Search).

Step 1: Set up a Google Sheet

1. Open Google Sheets.
2. In Column A, list your negative keywords (one per row).
3. Click Share and give access to your Google Ads email.
4. Copy the Google Sheet URL.

Step 2: Copy & paste this script

👉 Replace "YOUR_SHEET_URL" with your Google Sheet URL.

❗ Important: This script only works for **Search campaigns**.

If you need to automate negative keywords for **Shopping or PMax campaigns**, you must use a shared negative keyword list (see Script 2)  or opt for a no-code alternative (see Shopstory in the next section).

/**
 * ❗ Important: This script only works for **Search campaigns**. 
 */

function main() {
  var SPREADSHEET_URL = "YOUR_SHEET_URL";  // ← EDIT THIS WITH YOUR GOOGLE SHEET URL
  var SHEET_NAME = "Sheet1";  

  // Open the Google Sheet
  var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getSheetByName(SHEET_NAME);
  if (!sheet) {
    Logger.log("Error: Sheet not found. Check the sheet name.");
    return;
  }

  // Get negative keywords from Column A (excluding empty rows)
  var keywords = sheet.getRange("A:A").getValues();
  
  var campaigns = AdsApp.campaigns()
    .withCondition("AdvertisingChannelType = SEARCH") // Ensure it applies only to Search campaigns
    .get();

  while (campaigns.hasNext()) {
    var campaign = campaigns.next();
    
    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i][0];

      // Ensure the keyword is valid (not empty and a string)
      if (keyword && typeof keyword === "string") {
        keyword = keyword.trim();
        if (keyword.length > 0) {
          campaign.createNegativeKeyword(keyword);
          Logger.log("Added negative keyword '" + keyword + "' to campaign: " + campaign.getName());
        }
      }
    }
  }

  Logger.log("✅ Negative keywords updated from Google Sheets for all Search campaigns.");
}

Step 3: Run the script

1. Authorize Google Ads to make changes.
2. Click Preview to check for issues.
3. Click Run to sync negative keywords from your Google Sheet.

Why use Google Sheets?

  • No need to edit scripts—just update the sheet
  • Easy collaboration—anyone on your team can update the keywords

4️⃣ No-code alternative: Shopstory (Search & Shopping)

If scripting isn’t your thing, Shopstory can automate your negative keywords for both search ads and shopping ads without requiring a single line of code.

How Shopstory automates negative keywords

  1. Sign up for a free account and create a workspace
  2. Choose one of the negative keyword flows (Search or Shopping)
  3. Go through the Flow Guide and connect necessary integrations
  4. Enter a cost and conversion threshold to filter negative keywords
  5. After you complete the steps, underperforming keywords are flagged in Google Sheets for your review

👉 You can streamline further by using the Shopstory flow “Add negative keywords from Google Sheet” to automatically implement these negative keywords into Google Ads.

Why use Shopstory?

  • No coding or manual updates required
  • Reduces human error
  • Saves hours of work
  • Offers freemium plan

👉 Try Shopstory for free – no code and no scripts.

Summary: How to Automate Negative Keywords on Google Ads

If you’re ready to stop wasting money on irrelevant clicks, choose a method and start automating your negative keywords in Google Ads today.

Use Google Ads scripts if you’re comfortable with coding, or try Shopstory—a free, no-code alternative that eliminates the need for manual maintenance.

Interested?

Simply fill out the form and download the full white paper.

Oops! Something went wrong while submitting the form.