Guide
How to Connect Facebook Ads Reporting to Google Sheets Automatically
By Jonas Viray 10 min read
Quick answer
Use the Facebook Marketing API (part of the Graph API) to read your ad account's insights on a schedule, transform the data, and append or update rows in Google Sheets. An automation tool like n8n handles the schedule, the API call, the Sheets update and an optional Slack summary without anyone exporting reports by hand.
What you'll need
- Access to the Facebook ad account (and Business Manager admin rights, or someone who has them)
- A Meta developer app, used to generate an access token for the Marketing API
- A Google account with the destination spreadsheet
- An automation tool; this guide uses n8n, but the same flow works in Make or custom code
Step-by-step
- 1Get an access token. In your Meta app, generate a token with the ads_read permission. For ongoing reporting, use a long-lived token, ideally for a Business Manager system user, so it doesn't expire after a few hours.
- 2Decide the metrics and breakdown. Start with campaign ID and name, date, spend, impressions, clicks, CTR and CPC. Conversion results are usually nested in actions and depend on attribution settings; do not assume there is a universal results field.
- 3Create a schedule trigger. In n8n, add a Schedule Trigger node, for example every morning, or hourly for live dashboards.
- 4Call the Insights endpoint. Use an HTTP Request node to call the ad account's insights endpoint with your chosen fields, date range (such as yesterday or the last 7 days) and level (campaign, ad set or ad).
- 5Transform the response. Flatten nested values, convert currency and percentages to plain numbers, and add the report date so every row is traceable.
- 6Write to Google Sheets. Use the Google Sheets node to append new rows, or update rows keyed by date and campaign so reruns don't create duplicates.
- 7Add a summary (optional). Post a short Slack message with yesterday's spend and top campaigns, linking to the sheet.
- 8Handle errors. Route failures to an alert channel so an expired token or API change is noticed the same day.
Example: fetch daily campaign insights
This is a reference request you can adapt in an n8n HTTP Request node or a terminal, not the output of a live client account. Replace the API version and ad-account placeholder with values from your own Meta app. Use an ads_read-authorized token stored in n8n credentials; never paste it into a public workflow, URL, or Google Sheet.
curl --get 'https://graph.facebook.com/v<API_VERSION>/act_<AD_ACCOUNT_ID>/insights' \
--header "Authorization: Bearer ${META_ACCESS_TOKEN}" \
--data-urlencode 'level=campaign' \
--data-urlencode 'time_increment=1' \
--data-urlencode 'date_preset=last_7d' \
--data-urlencode 'fields=account_id,campaign_id,campaign_name,date_start,date_stop,spend,impressions,clicks,ctr,cpc' \
--data-urlencode 'limit=100'The campaign level produces campaign rows; time_increment=1 requests daily rows rather than a single total for the date range. A large result may include paging.next: follow pages until exhausted, then normalize the returned data. Use supported Meta API versions and test the request with an account you are authorized to access. For historical conversions, compare consistent attribution settings before interpreting results.
Suggested Google Sheets columns
| Column | Source / mapping | Why it matters |
|---|---|---|
| row_key | date_start + account_id + campaign_id | Unique daily campaign identifier for upserts |
| report_date | date_start | Use the Meta account's reporting date consistently |
| account_id | account_id | Prevents collisions across ad accounts |
| campaign_id | campaign_id | Stable identifier even when a campaign is renamed |
| campaign_name | campaign_name | Readable label for nontechnical reviewers |
| spend | Convert spend string to a number | Allows sums, charts, and budget checks |
| impressions | Convert impressions to a number | Tracks delivery |
| clicks | Convert clicks to a number | Tracks traffic |
| ctr / cpc | Convert returned strings to numbers | Enables trends; check units and blanks |
| last_synced_at | UTC timestamp from the automation run | Makes freshness and retries auditable |
For a single account, the row key can be YYYY-MM-DD|campaign_id. For multiple accounts, include account_id. If you later change the report level to ad set or ad, add the corresponding ID to the key. Keep campaign IDs as text so they are not altered by spreadsheet number formatting.
Build the n8n workflow so reruns are safe
- 1Schedule Trigger: choose a daily time after Meta's usual reporting cutoff; use the ad account time zone consistently.
- 2HTTP Request: request a recent rolling window, for example the last seven days, with the configured authorization header and campaign-level Insights fields.
- 3Pagination: request subsequent API pages rather than writing just the first page of campaigns.
- 4Transform: create row_key, normalize numeric metrics, keep campaign_id as text, and attach last_synced_at.
- 5Google Sheets: find an existing row by row_key and update it; append only when the key is new. Do not blindly append the entire rolling window each day.
- 6Verification: check whether the number of transformed rows matches the rows written, and compare a sample of values with Meta Ads Manager using the same date range and attribution settings.
- 7Error path: alert on 401/403 authentication failures, rate limits, malformed responses, and Google Sheets write errors; retry temporary failures with backoff instead of duplicating rows.
The example is a reusable implementation pattern, not a downloadable or independently tested workflow template. Permissions, fields, attribution windows, and pagination may vary by Meta account and API version, so verify the setup before using it for financial or client reporting.
Common pitfalls
- Expiring tokens: short-lived user tokens stop working quickly. Use a long-lived or system-user token and alert on authentication errors.
- Attribution windows: recent days' results can still change as conversions come in, so re-pull the last few days rather than only yesterday.
- Duplicates: appending blindly on every run duplicates data. Upsert by a unique key such as date plus campaign ID.
- Rate limits: large accounts or frequent runs can hit API limits. Request only the fields you need and avoid running more often than necessary.
Why automate it
Manual exports are slow and easy to get wrong, and they're only as fresh as the last person who ran them. An automated pipeline keeps numbers current, removes copy-paste errors and frees the team to act on the data instead of assembling it. I built this kind of pipeline for the Facebook Ads Data Live Report automation.
FAQ
Can I do this without code?
Mostly. n8n or Make handle the schedule and Sheets steps visually. The API request needs the right endpoint and fields, which is the part a developer typically sets up once.
Can the report go to a dashboard instead of Google Sheets?
Yes. The same data can feed a database behind a custom dashboard, or tools like Looker Studio reading from the sheet.
Real examples from my work
Want this built for your business?
See my workflow & operations automation and api & platform integrations service, or send a message with what you need.
Get in touch