Apify to Google Sheets, competitor ad insights ready
Competitor ad research starts simple. Then you’re drowning in tabs, screenshots, half-copied ad text, and a “we’ll organize this later” spreadsheet that never gets organized.
Apify Sheets automation fixes that mess. PPC managers use it to keep weekly swipe-file updates from taking over their calendar. A marketing lead can finally share competitor insights without a 20-minute walkthrough. And if you run an agency, you stop rebuilding the same “ad intel doc” for every new client.
This workflow pulls ads from the Facebook Ad Library, filters for quality, runs AI analysis based on the ad format (text, image, or video), and writes clean, searchable rows into Google Sheets. You’ll see what it does, why it matters, and how to adapt it for your niche.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Apify to Google Sheets, competitor ad insights ready
flowchart LR
subgraph sg0["When clicking ‘Execute workflow’ Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Execute workf..", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch", pos: "b", h: 48 }
n2@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Filter For Likes", pos: "b", h: 48 }
n3@{ icon: "mdi:cog", form: "rounded", label: "Wait", pos: "b", h: 48 }
n4@{ icon: "mdi:cog", form: "rounded", label: "Wait1", pos: "b", h: 48 }
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Download Video"]
n6@{ icon: "mdi:cog", form: "rounded", label: "Upload Video to Drive", pos: "b", h: 48 }
n7@{ icon: "mdi:cog", form: "rounded", label: "Wait2", pos: "b", h: 48 }
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Run Ad Library Scraper"]
n9@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Image Ads", pos: "b", h: 48 }
n10@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Text Ads", pos: "b", h: 48 }
n11@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Video Ads", pos: "b", h: 48 }
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Begin Gemini Upload Session"]
n13@{ icon: "mdi:cog", form: "rounded", label: "Redownload Video", pos: "b", h: 48 }
n14["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Upload Video to Gemini"]
n15["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Analyze Video with Gemini"]
n16@{ icon: "mdi:robot", form: "rounded", label: "Output Video Summary", pos: "b", h: 48 }
n17@{ icon: "mdi:database", form: "rounded", label: "Add as Type = Video", pos: "b", h: 48 }
n18@{ icon: "mdi:robot", form: "rounded", label: "Analyze Image", pos: "b", h: 48 }
n19@{ icon: "mdi:robot", form: "rounded", label: "Output Image Summary", pos: "b", h: 48 }
n20@{ icon: "mdi:database", form: "rounded", label: "Add as Type = Image", pos: "b", h: 48 }
n21@{ icon: "mdi:robot", form: "rounded", label: "Output Text Summary", pos: "b", h: 48 }
n22@{ icon: "mdi:database", form: "rounded", label: "Add as Type = Text", pos: "b", h: 48 }
n23@{ icon: "mdi:cog", form: "rounded", label: "Wait3", pos: "b", h: 48 }
n3 --> n10
n4 --> n9
n7 --> n11
n23 --> n15
n1 --> n11
n1 --> n9
n1 --> n10
n18 --> n19
n5 --> n6
n2 --> n1
n13 --> n14
n22 --> n3
n10 --> n21
n20 --> n4
n17 --> n7
n9 --> n18
n11 --> n5
n21 --> n22
n19 --> n20
n16 --> n17
n6 --> n12
n8 --> n2
n14 --> n23
n15 --> n16
n12 --> n13
n0 --> n8
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n16,n18,n19,n21 ai
class n1,n2 decision
class n17,n20,n22 database
class n5,n8,n12,n14,n15 api
classDef customIcon fill:none,stroke:none
class n5,n8,n12,n14,n15 customIcon
The Problem: Competitor ad research turns into busywork
Checking the Facebook Ad Library is easy. Turning it into something your team can reuse is the painful part. You click through ads one by one, copy text into a doc, grab a link, try to describe the creative, and then… you do it again next week. Worse, the best insights often live in someone’s browser history or a random Slack message. The cost isn’t just time; it’s decision quality. When research is messy, you stop trusting it, so you go back to guessing.
It adds up fast. Here’s where it breaks down in real life.
- Manually collecting 50 ads can eat up about 2–3 hours, and it still won’t be consistent across the team.
- Video ads are the worst because you can’t “scan” them quickly, so the best angles get skipped.
- Without a structured database, you can’t search by hook, offer type, or positioning, which means you keep re-learning the same lessons.
- Teams end up “borrowing” competitor language too closely because there’s no rewrite step built into the process.
The Solution: Apify → AI analysis → Google Sheets intelligence
This workflow turns Facebook Ad Library browsing into a repeatable competitor intelligence system. It starts by launching an Apify-powered scrape against your chosen Ad Library search parameters. The workflow then filters ads by page likes (so you’re not wasting time on low-signal advertisers) and routes each ad into the right analysis path: text-only ads get copy and strategy analysis, image ads get visual breakdowns, and video ads get a deeper “what’s happening here?” description before they’re summarized. Finally, every ad becomes a structured record in Google Sheets with a summary, inspired rewrite, and creative recreation prompts, so you can search and share it like a real asset.
The workflow starts when you run it in n8n. From there, Apify delivers the raw ad data, the system categorizes each ad by format, and AI generates the “so what” insights. Google Sheets becomes your single source of truth, updated automatically as you run new competitor pulls.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you track 5 competitors and pull 20 active ads per brand each week. Manually, you might spend about 3 minutes per ad to copy details, describe the creative, and drop it into a sheet, which is roughly 5 hours. With this workflow, you run the scrape once, let the batch processing and AI do the analysis, and review the completed Google Sheet at the end. Your hands-on time becomes closer to 30 minutes of checking and tagging, not half a workday of collecting.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Apify to scrape Facebook Ad Library results
- Google Sheets to store competitor ad intelligence
- Google Drive for temporary video storage during analysis
- OpenAI API key (get it from your OpenAI dashboard)
- Gemini API key (get it from Google AI Studio)
Skill level: Advanced. You’ll be comfortable connecting APIs, adjusting prompts, and troubleshooting occasional file/permission issues.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Scrape trigger. You run the workflow in n8n, which sends an HTTP request to launch the Apify Facebook Ad Library scraper using your pre-set search parameters.
Quality filtering and routing. The returned ads are filtered by page likes, then automatically categorized by media type (text, image, or video) so each format follows the right path.
AI analysis for each ad type. Text ads go to an OpenAI chat model for strategy and rewrite output. Image ads are analyzed with a vision-capable model so the workflow can explain what’s on the creative and why it works. Video ads are downloaded, stored temporarily in Google Drive, then sent through Gemini for video understanding before a final summary is generated.
Structured storage in Google Sheets. Each processed ad is appended as a new row with core identifiers (like ad archive ID and page details) plus the AI summary, rewritten ad copy, and creative recreation prompts.
You can easily modify the page-likes threshold to widen or tighten quality, based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Manual Trigger
This workflow starts manually so you can validate the scrape and analysis pipeline before automating it.
- Add the Manual Start Trigger node as your entry point.
- Leave all settings at default since this trigger has no parameters.
Step 2: Connect Google Drive and Google Sheets
Video files are stored in Drive, and all ad records are appended to Google Sheets.
- Open Store Video in Drive and select the target Drive and folder.
Credential Required: Connect yourgoogleDriveOAuth2Apicredentials. - Open Retrieve Drive Video and confirm Operation is set to
downloadand File ID uses{{ $('Store Video in Drive').item.json.id }}.
Credential Required: Connect yourgoogleDriveOAuth2Apicredentials. - Open Append Video Record, Append Image Record, and Append Text Record and select your spreadsheet.
Credential Required: Connect yourgoogleSheetsOAuth2Apicredentials. - Set Document to
[YOUR_ID]and Sheet Name togid=0in each append node.
Step 3: Set Up Ad Library Scrape and Routing
This section pulls ads from Apify, filters by page popularity, and routes by media type.
- Configure Launch Ad Library Scrape with URL
https://api.apify.com/v2/acts/XtaWFhbtfxyzqrFmd/run-sync-get-dataset-itemsand MethodPOST. - Set JSON Body to the provided payload and keep Send Body and Send Headers enabled.
- Update the header Authorization to
Bearer [CONFIGURE_YOUR_API_KEY]and keep Accept asapplication/json. - In Filter By Page Likes, set the condition Left Value to
{{ $json.advertiser.ad_library_page_info.page_info.likes }}and Right Value to1000. - In Route By Media Type, verify the rule expressions:
Video uses{{ $json.snapshot.videos[0].video_sd_url }}, Image uses{{ $json.snapshot.images[0].original_image_url }}, and the fallback output is renamed toText.
[CONFIGURE_YOUR_API_KEY] in Launch Ad Library Scrape, Initiate Gemini Upload, Send Video to Gemini, and Gemini Video Analysis.Step 4: Set Up Video Processing with Gemini and OpenAI
Video ads are downloaded, uploaded to Gemini, analyzed, summarized with OpenAI, and saved to Sheets.
- In Iterate Video Ads, keep batch settings default to process items sequentially.
- Set Fetch Video File URL to
{{ $json.snapshot.videos[0].video_sd_url }}. - In Initiate Gemini Upload, keep URL as
https://generativelanguage.googleapis.com/upload/v1beta/files, and confirm the header X-Goog-Upload-Header-Content-Length is{{ $json.size }}. - In Send Video to Gemini, set URL to
{{ $json.headers['x-goog-upload-url'] }}and Input Data Field Name todata. - Set Delay Before Analysis Amount to
15to allow Gemini file processing. - Configure Gemini Video Analysis with the JSON body using
{{ $json.file.mimeType }}and{{ $json.file.uri }}. - Open Generate Video Summary and confirm it uses model
gpt-4.1with JSON Output enabled.
Credential Required: Connect youropenAiApicredentials.
Step 5: Set Up Image and Text Summaries with OpenAI
Image and text ads are summarized using OpenAI before being written to Sheets.
- In Analyze Image Content, set Image URLs to
{{ $json.snapshot.images[0].original_image_url }}and keep Operation asanalyze.
Credential Required: Connect youropenAiApicredentials. - In Generate Image Summary, confirm the message references
{{ $('Iterate Image Ads').item.json.toJsonString() }}and{{ $json.content }}with JSON Output enabled.
Credential Required: Connect youropenAiApicredentials. - In Generate Text Summary, keep the message content as
{{ $json.toJsonString() }}and ensure JSON Output is enabled.
Credential Required: Connect youropenAiApicredentials.
Step 6: Configure Output Records and Throttling
Each media type is appended to the same Google Sheet and then throttled with waits to control throughput.
- In Append Video Record, map fields like summary to
{{ $json.message.content.summary }}and video_prompt to{{ $('Gemini Video Analysis').item.json.candidates[0].content.parts[0].text }}. - In Append Image Record, map image_prompt to
{{ $('Analyze Image Content').item.json.content }}and summary to{{ $json.message.content.summary }}. - In Append Text Record, map summary to
{{ $json.message.content.summary }}and rewritten_ad_copy to{{ $json.message.content.rewrittenAdCopy }}. - Set Pause After Video Save, Pause After Image Save, and Pause After Text Save Amount to
1to throttle batch processing.
Step 7: Test and Activate Your Workflow
Run a manual test to validate scraping, analysis, and sheet output before enabling production use.
- Click Execute Workflow on Manual Start Trigger to run a test.
- Verify that Launch Ad Library Scrape returns items, and Filter By Page Likes passes records with likes above
1000. - Confirm that video, image, and text items reach their respective append nodes and rows appear in your sheet
Facebook Ad Library Analyzer DB. - Once verified, switch the workflow to Active for production use (or keep it manual if you only want on-demand runs).
Common Gotchas
- Apify credentials can expire or need specific permissions. If things break, check your Apify token in n8n credentials and the Apify task run logs first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Google Drive and Google Sheets permissions bite people constantly. Make sure the connected Google account can write to the target Sheet and upload to the chosen Drive folder.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 3–4 hours, mostly for API setup and prompt tuning.
No. You’ll mostly connect accounts, paste API keys, and edit prompts and filters. If you can follow a checklist carefully, you can run it.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Apify, OpenAI, and Gemini usage (this workflow is often around $200/month to operate at steady volume).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you should. Most customization happens in the AI prompt steps used for text, image, and video summaries, plus the “Filter By Page Likes” logic for quality control. Common tweaks include adding a niche-specific framework (AIDA, PAS, or “offer breakdown”), saving extra columns (like hook type or objection addressed), and changing the Apify search parameters to focus on certain regions or keywords.
Usually it’s an expired or incorrect Apify API token in your n8n credentials. Check the Apify run logs for the task to confirm the scraper actually returned items, then confirm your HTTP request headers match Apify’s expected auth format. If it works once and then starts failing, rate limits or quota can also be the culprit, especially on larger pulls.
Hundreds per run is realistic, but your practical limit is API quota and how long you’re willing to let it process.
For this use case, yes, but it depends on your expectations. Zapier and Make are great for simple “send data from A to B,” yet this workflow needs branching logic (text vs image vs video), batching, waits, file handling, and multiple AI calls. n8n handles that without turning your automation into a fragile, expensive maze. If your goal is a lightweight log of a few ads, simpler tools can be fine. If you want a scalable competitor intel system you can sell or standardize across clients, n8n is a better fit. Talk to an automation expert if you’re not sure which fits.
Once this is running, competitor research stops being a recurring fire drill. You get a living Google Sheet your team can actually use, week after week.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.