Scriptlytics
  • Introduction
    • Welcome to the community
  • Account level scripts
    • Account overview (all time)
    • Account performance (date range)
    • Account performance (daily export)
    • Account performance (last 90 days)
    • Account search query optimizer
    • Account search query optimizer (yesterday)
    • Call asset scheduling
    • Account keyword optimizer (date range)
    • Account keyword optimizer (last 90 days)
    • Match type report (last 360 days)
    • Negative keyword list
  • Campaign level scripts
    • Campaign performance (date range)
    • Campaign performance (daily export)
    • Campaign performance (last 90 days)
    • Multiple campaign performance (last 90 days)
    • Ad groups (date range)
    • Ad groups (last 30 days)
    • Keyword optimizer (date range)
    • Keyword optimizer (last 30 days)
    • Impressions heatmap (date range)
    • Impressions heatmap (last 30 days)
    • Clicks heatmap (date range)
    • Clicks heatmap (last 30 days)
    • CTR heatmap (date range)
    • CTR heatmap (last 30 days)
    • Conversions heatmap (last 30 days)
    • Conversions heatmap (date range)
    • Conversion rate heatmap (last 30 days)
    • Conversion rate heatmap (date range)
    • CPC heatmap (last 30 days)
    • CPC heatmap (date range)
  • pmax scripts
    • Pmax segmentation
    • Pmax search query optimizer
    • Pmax search query optimizer (all time)
  • Call reports
    • Call report (date range)
    • Call report (evergreen)
  • Bulk edit and actions
    • Bulk upload template
    • Swap Base URL's
    • Copy campaign and swap base URL's
  • Alerts and notifications
    • Zero spend alert
  • MCC scripts
    • MCC account performance export
    • Revised MCC account performance export
  • Search ads
    • Keyword match optimizer
  • Google sheets
    • Remove the following keywords
    • Remove keywords that don't contain
    • Remove keywords that don't contain and create negative keyword list
  • Product title modification
Powered by GitBook
On this page
  1. Google sheets

Remove the following keywords

  1. Open your Google Sheet.

  2. Go to Extensions > Apps Script.

  3. Delete any existing code in the editor and paste the following script.

  4. Save the script and give it a name.

  5. Close the Apps Script editor and refresh your Google Sheet.

  6. Run the function removeRowsByKeywords.

function removeRowsContainingWord() {
  // Define the word to search for
  const wordToRemove = "word"; // Replace "word" with the actual word you want to match
  const columnToCheck = 0; // Index of the column to check (0 = Column A, 1 = Column B, etc.)
  
  // Get the active sheet and its data
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  const data = sheet.getDataRange().getValues(); // Get all data in the sheet

  // Loop through the rows in reverse to avoid skipping rows after deletion
  for (let i = data.length - 1; i >= 1; i--) { // Start from the last row, skip the header
    const cellValue = data[i][columnToCheck].toLowerCase(); // Convert to lowercase for case-insensitive comparison
    
    // Check if the cell contains the word
    if (cellValue.includes(wordToRemove.toLowerCase())) {
      sheet.deleteRow(i + 1); // Delete the row (adjust for 0-based indexing)
    }
  }
  
  SpreadsheetApp.flush(); // Ensure all changes are applied
}
PreviousKeyword match optimizerNextRemove keywords that don't contain

Last updated 5 months ago