AutomationFlowsAI & RAG › Analyze Meta Ad Library Video Ads with Gemini and Store Results in Google Sheets

Analyze Meta Ad Library Video Ads with Gemini and Store Results in Google Sheets

ByDaniel Setzermann @danielsetzermann on n8n.io

This n8n template builds an automated system to scrape, analyze, and extract insights from Meta advertising content. The workflow uses AI to perform deep analysis of video ads and organize the results in a structured format.

Event trigger★★★★☆ complexityAI-powered24 nodesGoogle Gemini ChatGoogle SheetsAgentHTTP RequestOutput Parser Structured
AI & RAG Trigger: Event Nodes: 24 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #3069 — we link there as the canonical source.

This workflow follows the Agent → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "Yfi6wLGrS1JxYNeN",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Scrape Meta Ad Library and analyze Video Ads with Gemini and store data to Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "30c7e140-fafe-4ae7-9de9-a969857967d5",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -100,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d38614bf-bbcc-4619-bcc4-cb42a80a1148",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        100,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "7bb34d03-5cf0-497a-bead-87df84661ffd",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1960,
        380
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "d23fed5b-f230-4511-b4ea-76393617e740",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        3460,
        700
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e56dbefc-458f-40db-850e-f243740c5651",
      "name": "Clean Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        300,
        380
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6dbce614-58ce-4389-be16-a117ba5b6032",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        0
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1f26b54d-d0c5-483b-b3cf-e5e971128f2e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3260,
        300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e554fcd8-90f0-4f38-ad78-1b08f4cd4a82",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3360,
        860
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "96359003-2cd3-4ebf-90aa-8be4c44f1949",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3640,
        320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3e3c13b8-063c-4e0d-99dd-93902646c197",
      "name": "Store Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3860,
        440
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "717fa264-afc3-4e2f-a48a-f3101e3ccf97",
      "name": "Structured Output Parsing Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3480,
        440
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "a61b82eb-21bf-4a0a-8863-e3fd3321c280",
      "name": "Wait for Upload Processing",
      "type": "n8n-nodes-base.wait",
      "position": [
        3020,
        440
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b3a0113f-a5e4-45e6-b093-a61ec5933446",
      "name": "Pass Values for Gemini",
      "type": "n8n-nodes-base.set",
      "position": [
        2780,
        440
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "590f1356-4e6a-4e2a-aef4-9ec3c421b3bf",
      "name": "Upload Video to Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2580,
        440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "88d88a31-4137-40e9-8470-4fb247cfac27",
      "name": "Analyze Video with Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3240,
        440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "2168902d-1a0c-4807-9e88-08b9349ba19a",
      "name": "Download File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2200,
        440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "4fc6c731-ac04-4b33-a7df-919bff17ddc1",
      "name": "Change Filetype to Video",
      "type": "n8n-nodes-base.code",
      "position": [
        2380,
        440
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "9cb29e1e-be52-4f7d-90aa-c930d283d442",
      "name": "Scrape Meta Ad Library with Apify",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        380
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "59a198fa-3859-41a0-806b-280e9b9dd72a",
      "name": "Pass relevant Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1720,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "ea30c850-3ae8-455e-9681-f42f59681a8a",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3660,
        700
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "ac3ae0cd-8dda-4b38-858e-d3f4f21f7e5c",
      "name": "Calculate Runtime in Days",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "28d391b3-d708-43a1-9d4b-28da08bc8175",
      "name": "Sort by Reach or Days Running",
      "type": "n8n-nodes-base.sort",
      "position": [
        960,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "82f7bdd7-5d20-4431-9772-4255e21ea963",
      "name": "Filter only Video Ads",
      "type": "n8n-nodes-base.filter",
      "position": [
        1200,
        380
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b0a7273e-f540-49e9-98c2-f0437ea2749d",
      "name": "Limit Videos to Analyze",
      "type": "n8n-nodes-base.limit",
      "position": [
        1460,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "79ac2590-6d68-4f1d-adb5-2c2fb5541f90",
  "connections": {
    "Settings": {
      "main": [
        [
          {
            "node": "Clean Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Prompt": {
      "main": [
        [
          {
            "node": "Scrape Meta Ad Library with Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Change Filetype to Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pass relevant Fields": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter only Video Ads": {
      "main": [
        [
          {
            "node": "Limit Videos to Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pass Values for Gemini": {
      "main": [
        [
          {
            "node": "Wait for Upload Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Gemini": {
      "main": [
        [
          {
            "node": "Pass Values for Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit Videos to Analyze": {
      "main": [
        [
          {
            "node": "Pass relevant Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change Filetype to Video": {
      "main": [
        [
          {
            "node": "Upload Video to Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parsing Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Structured Output Parsing Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Video with Gemini": {
      "main": [
        [
          {
            "node": "Structured Output Parsing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Runtime in Days": {
      "main": [
        [
          {
            "node": "Sort by Reach or Days Running",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Upload Processing": {
      "main": [
        [
          {
            "node": "Analyze Video with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Reach or Days Running": {
      "main": [
        [
          {
            "node": "Filter only Video Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parsing Agent": {
      "main": [
        [
          {
            "node": "Store Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Meta Ad Library with Apify": {
      "main": [
        [
          {
            "node": "Calculate Runtime in Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n template builds an automated system to scrape, analyze, and extract insights from Meta advertising content. The workflow uses AI to perform deep analysis of video ads and organize the results in a structured format.

Source: https://n8n.io/workflows/3069/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.

OpenAI Chat, Memory Buffer Window, Output Parser Structured +11
AI & RAG

This Shopify AI automation is an advanced n8n-powered workflow that transforms Shopify product collections into SEO-optimized blog articles with images, while maintaining full visibility and control t

Shopify Trigger, HTTP Request, Google Sheets +7
AI & RAG

LinkedIn URL → Scrape → Match → Screen → Decide, all automated

Google Drive, Agent, Google Drive Tool +6
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Output Parser Structured, Telegram, N8N Nodes Tesseractjs +14
AI & RAG

This workflow is a fully automated YouTube Shorts production pipeline. It takes the structured output from a video digestion workflow (transcript, key moments, metadata) and produces finished, rendere

HTTP Request, Google Drive, Execute Workflow Trigger +5