Practical Tools
facebook-adsweb-scrapingcsv-exportcompetitive-analysis

Export Facebook Ad Data to CSV: Fast Workflow

Learn how to export Facebook ad data to CSV for analysis without HAR files. Step-by-step workflow using the Facebook Ad Library Scraper actor.

How to Export Facebook Ad Data to CSV for Analysis

To export Facebook ad data to CSV, run the Facebook Ad Library Scraper on Apify with your target page ID or keyword, then click "Export results" and choose CSV. The whole process takes about 90 seconds and avoids the HAR file method entirely — no Chrome DevTools, no JSON parsing, no broken selectors when Meta updates their UI.

Quick Answer

The fastest way to export Facebook ad data CSV is to use a pre-built Apify actor like the Facebook Ad Library Scraper instead of manually capturing HAR files from the Ad Library website. You input a page name, page ID, or keyword, the actor pulls every active ad (with creative URLs, ad copy, start dates, and platform targeting), and Apify's dataset viewer exports directly to CSV, JSON, or Excel. A run pulling 500 ads typically costs under $0.20 and finishes in under two minutes. This approach scales to thousands of pages and integrates with Make, Zapier, or a cron job.

Why exporting Facebook Ad Library data manually is painful

The Facebook Ad Library has no native export button. The two manual options both have problems:

  1. Copy-paste from the browser — fine for 5 ads, useless for 500. You lose structured fields like ad ID, start date, and platforms.
  2. HAR file method — open DevTools, filter the network tab for graphql, save the HAR, then write a Python script to parse nested JSON arrays. It works once. Then Meta renames a field (ad_archive_idarchive_id) and your parser breaks silently.

A scraping actor handles the GraphQL endpoints, pagination, and schema drift so you don't have to. Here's what the workflow looks like end-to-end.

Step-by-step: export Facebook ad data to CSV

1. Get the Facebook Page ID or keyword

You need one of:

  • Page name (e.g., Nike)
  • Page ID (15-digit number from the URL facebook.com/profile.php?id=... or from the Ad Library URL view_all_page_id=...)
  • Keyword (e.g., protein powder)

Page ID is the most reliable — it never changes even if the brand renames.

2. Configure the actor input

Open the Facebook Ad Library Scraper on Apify and set:

{
  "urls": [
    "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id=15087023444"
  ],
  "maxItems": 500,
  "activeStatus": "active"
}

Key parameters worth knowing:

  • country — two-letter code. Ads are region-specific.
  • activeStatusactive, inactive, or all. Inactive ads include historical creatives going back to 2018 for political ads.
  • ad_type — set to political_and_issue_ads to get spend and impression ranges (only available for those categories).

3. Run the actor

Click Start. For 500 ads expect 60–120 seconds. Apify charges per compute unit; a typical 500-ad run is $0.10–$0.30 depending on creative download volume.

4. Export to CSV

When the run finishes, go to the Storage tab → DatasetExport. Choose CSV and pick which fields to include. Common fields:

FieldExample
adArchiveId1234567890123456
pageNameNike
adText"Just Do It. Shop the new..."
startDate2026-05-14
endDatenull (still running)
platforms["facebook","instagram"]
snapshotUrlhttps://facebook.com/ads/library/?id=...
imageUrls["https://..."]
videoUrls["https://..."]
ctaTextShop Now
linkUrlhttps://nike.com/promo

Download the CSV. Open in Excel, Google Sheets, or pipe into pandas.

How do I export competitor Facebook ads in bulk?

To analyze 50 competitors at once, pass an array of Ad Library URLs in the urls field — one per competitor. The actor processes them in parallel and writes everything to a single dataset, so you get one consolidated CSV.

A practical trick: build the URLs in a Google Sheet using a formula:

="https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&view_all_page_id="&A2

where column A holds page IDs. Copy the URL column into the actor input. For 50 brands with ~30 ads each, expect 1,500 rows and a runtime of about 4 minutes.

Can I get Facebook ad spend data in the CSV?

Spend and impression data is only available for political and issue ads under Meta's transparency rules. Commercial ads (Nike, DTC brands, SaaS) don't expose spend — anywhere. Anyone selling you a tool that claims commercial spend is estimating with proxy signals (run duration × creative count) at best.

For political ads, set ad_type=political_and_issue_ads and you'll get:

  • spend.lower_bound / spend.upper_bound (USD ranges like $1,000–$4,999)
  • impressions.lower_bound / impressions.upper_bound
  • demographic_distribution (age, gender, region splits)

This is enough to track political advertiser strategy over time. For commercial competitive analysis, focus on ad count, creative variety, and run duration as proxies for budget priority.

How do I automate Facebook ad exports on a schedule?

Apify has built-in scheduling. In the actor's Schedules tab:

  1. Click Create new schedule
  2. Set cron: 0 9 * * 1 (every Monday 9 AM UTC)
  3. Use the same input JSON as your manual runs
  4. Add a webhook to push the CSV to S3, Google Drive, or Slack

For more complex pipelines, call the Apify API directly:

curl -X POST "https://api.apify.com/v2/acts/ACTOR_ID/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls":[{"url":"https://www.facebook.com/ads/library/?view_all_page_id=15087023444"}]}'

Then poll the run status and download the dataset as CSV:

curl "https://api.apify.com/v2/datasets/DATASET_ID/items?format=csv" > ads.csv

This is the same pattern that powers automated competitive intelligence dashboards in Looker or Metabase.

What can I do with the exported CSV data?

Concrete analyses that take 10 minutes once you have the CSV:

  • Creative refresh rate — group by pageName, count ads with startDate in the last 30 days. Brands refreshing weekly are testing aggressively.
  • Copy length distributionLEN(adText) histogram. Top performers in DTC tend to cluster at either 40–80 chars (hook-only) or 300+ chars (long-form storytelling).
  • Platform mix — what % of ads target Instagram only vs. Facebook+Instagram. Reveals where the brand sees ROI.
  • CTA breakdown — pivot on ctaText. Shop Now vs Learn More vs Sign Up tells you funnel stage.
  • Video vs. static ratio — count rows with non-empty videoUrls. Video-heavy means higher production budgets.

For a Python workflow:

import pandas as pd
df = pd.read_csv("ads.csv")
df["startDate"] = pd.to_datetime(df["startDate"])
df["days_running"] = (pd.Timestamp.today() - df["startDate"]).dt.days

# Ads running >60 days are "winners" — survived testing
winners = df[df["days_running"] > 60]
print(winners.groupby("pageName").size().sort_values(ascending=False).head(10))

FAQ

Q: How much does it cost to export 10,000 Facebook ads to CSV? On Apify's pay-per-use pricing, scraping ~10,000 ads typically runs $2–$5 in compute, plus minor storage costs. The cost scales linearly with ad count and whether you download creative media (images/videos add bandwidth).

Q: Can I export ads from countries outside the US? Yes. Set the country parameter to any two-letter ISO code (GB, DE, IN, BR, etc.). The Ad Library is region-locked, so a French ad won't appear in a US query — you have to run a separate scrape per country and concatenate the CSVs.

Q: Does the CSV include the actual ad images and videos? The CSV contains direct URLs to images and videos hosted on Meta's CDN. You can download the media in a separate step using wget or a Python script iterating over the URL columns. Note that Meta's CDN URLs expire after several weeks, so archive what you need promptly.

Q: What's the difference between the HAR file method and using an actor? The HAR method requires you to manually capture network requests in Chrome DevTools, then write a parser for Meta's GraphQL response structure — which changes every few months. An actor abstracts all of that: you pass a URL, you get clean structured data. You're trading $0.20 per run for ~3 hours of engineering time per breakage.

Q: Can I filter ads by date range before exporting? The actor pulls all ads matching your activeStatus filter, then you filter the CSV downstream. For active ads, Meta shows everything currently running. For inactive (historical) ads, you get everything in the archive — typically political ads back to 2018 — and you filter by startDate in Excel or pandas.