AutomationFlowsMarketing & Ads › Meta Ads to Google Sheets: Daily & Historical Reports

Meta Ads to Google Sheets: Daily & Historical Reports

Original n8n title: Meta Ads to Google Sheets: Daily & Historical Campaign Performance Report

ByReinhard Schmidbauer @rschmidbauer on n8n.io

This template automatically exports Meta (Facebook) Ads campaign performance into Google Sheets — both daily and for historical backfills. It’s ideal for performance marketers, agencies, and analytics teams who want a reliable data pipeline from Meta Ads into their reporting…

Event trigger★★★★☆ complexity14 nodesFacebook Graph ApiGoogle Sheets
Marketing & Ads Trigger: Event Nodes: 14 Complexity: ★★★★☆ Added:

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

This workflow follows the Facebookgraphapi → 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": "o7ecGYTLdbaBQn6z",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Meta Ads to Google Sheets: Campaign Performance Report copy",
  "tags": [
    {
      "id": "jw1C7trTRmcAu3U3",
      "name": "Meta Ads",
      "createdAt": "2025-12-04T15:47:58.558Z",
      "updatedAt": "2025-12-04T15:47:58.558Z"
    },
    {
      "id": "Q6TPG9DK57zhSXnO",
      "name": "Google Sheets",
      "createdAt": "2025-12-04T15:48:09.571Z",
      "updatedAt": "2025-12-04T15:48:09.571Z"
    }
  ],
  "nodes": [
    {
      "id": "cae5b161-f06e-4ee8-9aa7-8b66797a0d0f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        208
      ],
      "parameters": {
        "color": 3,
        "width": 1136,
        "height": 592,
        "content": "## Manual Backfill (Historical Data)\nUse this section to **backfill historical Meta Ads performance** for a custom date range (e.g. last year or last 24 months).\n\n**Flow:**\n1. `Manual backfill trigger` \u2013 run this section by clicking *Execute workflow*.\n2. `Set backfill config` \u2013 define `backfillSince` and `backfillUntil` (e.g. quarterly ranges).\n3. `Fetch Meta Insights (time_range)` \u2013 calls the Insights API with a `time_range` parameter.\n4. `Transform backfill data for Sheets` \u2013 same logic as the daily transform.\n5. `Append backfill rows to Google Sheet` \u2013 appends rows for each campaign-day.\n\n\n**How to use:**\n- Adjust the `backfillSince` and `backfillUntil` fields in `Set backfill config`.\n- Run the workflow once per time block (e.g. per quarter or year).\n- Avoid overlapping date ranges to prevent duplicate rows."
      },
      "typeVersion": 1
    },
    {
      "id": "4efc8c61-7e80-4daa-a434-2e390c44a58c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -384
      ],
      "parameters": {
        "color": 4,
        "width": 1136,
        "height": 576,
        "content": "## Daily Incremental Export\nThis section runs **once per day at 06:00** and appends **yesterday's campaign-level performance** to Google Sheets.\n\n**Flow:**\n1. `Daily schedule (06:00)` \u2013 cron trigger.\n2. `Set config (Meta + Sheets)` \u2013 set ad account, date preset (`yesterday`), and Sheet ID.\n3. `Fetch Meta Insights (yesterday)` \u2013 calls the Facebook Graph `insights` edge.\n4. `Transform Meta data for Sheets` \u2013 flattens the API response and computes CPL/CPA/ROAS.\n5. `Append daily rows to Google Sheet` \u2013 appends one row per campaign to your `Meta_Daily_Data` sheet.\n\n\n**Setup:**\n- Check the `Set config` node values.\n- Make sure the Google Sheet has matching column headers.\n- Enable the workflow once everything is configured."
      },
      "typeVersion": 1
    },
    {
      "id": "370153b4-d750-4551-9610-9a98daca92aa",
      "name": "Set config (Meta + Sheets)",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bfa549cd-b7f6-4bb8-bbcd-73e35e663ca1",
              "name": "adAccountId",
              "type": "string",
              "value": "act_<YOUR_AD_ACCOUNT_ID>"
            },
            {
              "id": "afdf088e-20e4-48fb-8691-62d3ac5d7ae4",
              "name": "datePreset",
              "type": "string",
              "value": "yesterday"
            },
            {
              "id": "30b159c3-e5d3-45ab-a124-0828d46fb239",
              "name": "level",
              "type": "string",
              "value": "campaign"
            },
            {
              "id": "b95b113f-b84b-4bc4-8e2f-a08891793c5f",
              "name": "timeIncrement",
              "type": "string",
              "value": "1"
            },
            {
              "id": "b058e72f-9de2-45c2-9d4f-1a6314c277fe",
              "name": "sheetId",
              "type": "string",
              "value": "YOUR_SHEET_ID"
            },
            {
              "id": "57d9f2fa-e50b-46f3-ba70-7037e86462dd",
              "name": "sheetNameData",
              "type": "string",
              "value": "Meta_Daily_Data"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "98ac8d03-d209-4322-af35-4cd71fe1cbe0",
      "name": "Fetch Meta Insights (yesterday)",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        416,
        0
      ],
      "parameters": {
        "edge": "insights",
        "node": "={{ $json[\"adAccountId\"] }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "date_start"
              },
              {
                "name": "date_stop"
              },
              {
                "name": "account_id"
              },
              {
                "name": "account_name"
              },
              {
                "name": "campaign_id"
              },
              {
                "name": "campaign_name"
              },
              {
                "name": "objective"
              },
              {
                "name": "adset_id"
              },
              {
                "name": "adset_name"
              },
              {
                "name": "ad_id"
              },
              {
                "name": "ad_name"
              },
              {
                "name": "impressions"
              },
              {
                "name": "reach"
              },
              {
                "name": "clicks"
              },
              {
                "name": "inline_link_clicks"
              },
              {
                "name": "spend"
              },
              {
                "name": "ctr"
              },
              {
                "name": "cpc"
              },
              {
                "name": "cpm"
              },
              {
                "name": "actions"
              },
              {
                "name": "action_values"
              },
              {
                "name": "frequency"
              }
            ]
          },
          "queryParameters": {
            "parameter": [
              {
                "name": "level",
                "value": "={{ $json[\"level\"] }}"
              },
              {
                "name": "date_preset",
                "value": "={{ $json[\"datePreset\"] }}"
              },
              {
                "name": "time_increment",
                "value": "={{ $json[\"timeIncrement\"] }}"
              },
              {
                "name": "limit",
                "value": "1000"
              },
              {
                "name": "action_attribution_windows",
                "value": "[\"1d_click\",\"7d_click\",\"1d_view\"] "
              },
              {
                "name": "breakdowns",
                "value": "publisher_platform"
              }
            ]
          }
        },
        "graphApiVersion": "v23.0"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0f89b4ef-0fc5-436a-9213-6f7e9bc0a0b2",
      "name": "Transform Meta data for Sheets",
      "type": "n8n-nodes-base.code",
      "position": [
        624,
        0
      ],
      "parameters": {
        "jsCode": "// Erwartet: items[] aus dem Facebook Graph API Node\n// Wir bauen eine flache Struktur pro Kampagne/Adset/Ad\n\nconst out = [];\n\nfor (const item of items) {\n  // Meta liefert die Ergebnisse in item.json.data als Array\n  const dataArray = Array.isArray(item.json.data) ? item.json.data : [];\n\n  for (const s of dataArray) {\n    const row = {};\n\n    // Basisinfo & Struktur\n    row.date = s.date_start || s.date_stop || null;\n    row.account_id = s.account_id || null;\n    row.account_name = s.account_name || null;\n\n    row.campaign_id = s.campaign_id || null;\n    row.campaign_name = s.campaign_name || null;\n    row.objective = s.objective || null;\n\n    row.adset_id = s.adset_id || null;\n    row.adset_name = s.adset_name || null;\n    row.ad_id = s.ad_id || null;\n    row.ad_name = s.ad_name || null;\n\n    row.publisher_platform = s.publisher_platform || null;\n    \n    // Standardmetriken\n    row.impressions = Number(s.impressions || 0);\n    row.reach = Number(s.reach || 0);\n    row.frequency = Number(s.frequency || 0);\n    row.spend = Number(s.spend || 0);\n    row.clicks = Number(s.clicks || 0);\n    row.inline_link_clicks = Number(s.inline_link_clicks || 0);\n    row.ctr = Number(s.ctr || 0);\n    row.cpc = Number(s.cpc || 0);\n    row.cpm = Number(s.cpm || 0);\n\n    // Actions & Values\n    const actions = Array.isArray(s.actions) ? s.actions : [];\n    const actionValues = Array.isArray(s.action_values) ? s.action_values : [];\n\n    const getAction = (type) => {\n      const f = actions.find(a => a.action_type === type);\n      return f ? Number(f.value || 0) : 0;\n    };\n\n    const getActionValue = (type) => {\n      const f = actionValues.find(a => a.action_type === type);\n      return f ? Number(f.value || 0) : 0;\n    };\n\n    // Konversionsmetriken f\u00fcr diverse Ziele\n    row.leads = getAction('lead');\n    row.on_facebook_lead = getAction('onsite_conversion.lead_grouped');\n\n    row.purchases = getAction('purchase');\n    row.purchase_value = getActionValue('purchase');\n\n    row.add_to_cart = getAction('add_to_cart');\n    row.initiate_checkout = getAction('initiate_checkout');\n\n    // Abgeleitete KPIs\n    row.cpl = row.leads > 0 ? row.spend / row.leads : null;\n    row.cpa = row.purchases > 0 ? row.spend / row.purchases : null;\n    row.roas = row.purchase_value > 0 && row.spend > 0\n      ? row.purchase_value / row.spend\n      : null;\n\n    out.push({ json: row });\n  }\n}\n\nreturn out;"
      },
      "typeVersion": 2
    },
    {
      "id": "68f4c2be-3004-4854-a0de-bb6ff066ce02",
      "name": "Append daily rows to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        832,
        0
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "account_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "account_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "account_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "account_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "platform",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "platform",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "campaign_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "campaign_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "objective",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "objective",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "adset_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "adset_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "adset_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "adset_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ad_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ad_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "impressions",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "impressions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reach",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "reach",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "frequency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "frequency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "spend",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "spend",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "clicks",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "clicks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "inline_link_clicks",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "inline_link_clicks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ctr",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ctr",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpc",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpc",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpm",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpm",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "leads",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "leads",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "on_facebook_lead",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "on_facebook_lead",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchases",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "purchases",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchase_value",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "purchase_value",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "add_to_cart",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "add_to_cart",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "initiate_checkout",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "initiate_checkout",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpl",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpa",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpa",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "roas",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "roas",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set config (Meta + Sheets)').item.json.sheetNameData }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set config (Meta + Sheets)').item.json.sheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "39d67916-0176-4a74-b8af-2c27c11311c7",
      "name": "Manual backfill trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        608
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f2047a33-ee87-45b3-9384-e64a220b0160",
      "name": "Set backfill config",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        608
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bfa549cd-b7f6-4bb8-bbcd-73e35e663ca1",
              "name": "adAccountId",
              "type": "string",
              "value": "act_<YOUR_AD_ACCOUNT_ID>"
            },
            {
              "id": "30b159c3-e5d3-45ab-a124-0828d46fb239",
              "name": "level",
              "type": "string",
              "value": "campaign"
            },
            {
              "id": "b95b113f-b84b-4bc4-8e2f-a08891793c5f",
              "name": "timeIncrement",
              "type": "string",
              "value": "1"
            },
            {
              "id": "b058e72f-9de2-45c2-9d4f-1a6314c277fe",
              "name": "sheetId",
              "type": "string",
              "value": "YOUR_SHEET_ID"
            },
            {
              "id": "57d9f2fa-e50b-46f3-ba70-7037e86462dd",
              "name": "sheetNameData",
              "type": "string",
              "value": "Meta_Daily_Data"
            },
            {
              "id": "a779d41c-cf13-428f-9ed1-cf94233341fb",
              "name": "backfillSince",
              "type": "string",
              "value": "2024-01-01"
            },
            {
              "id": "53c3022c-726b-4693-8f51-b04ab6fa44a3",
              "name": "backfillUntil",
              "type": "string",
              "value": "2024-03-31"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7d12f840-7b40-4293-a2fe-aafc7fec333a",
      "name": "Fetch Meta Insights (time_range)",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        416,
        608
      ],
      "parameters": {
        "edge": "insights",
        "node": "={{ $json[\"adAccountId\"] }}",
        "options": {
          "fields": {
            "field": [
              {
                "name": "date_start"
              },
              {
                "name": "date_stop"
              },
              {
                "name": "account_id"
              },
              {
                "name": "account_name"
              },
              {
                "name": "campaign_id"
              },
              {
                "name": "campaign_name"
              },
              {
                "name": "objective"
              },
              {
                "name": "adset_id"
              },
              {
                "name": "adset_name"
              },
              {
                "name": "ad_id"
              },
              {
                "name": "ad_name"
              },
              {
                "name": "impressions"
              },
              {
                "name": "reach"
              },
              {
                "name": "clicks"
              },
              {
                "name": "inline_link_clicks"
              },
              {
                "name": "spend"
              },
              {
                "name": "ctr"
              },
              {
                "name": "cpc"
              },
              {
                "name": "cpm"
              },
              {
                "name": "actions"
              },
              {
                "name": "action_values"
              },
              {
                "name": "frequency"
              },
              {
                "name": "platform"
              }
            ]
          },
          "queryParameters": {
            "parameter": [
              {
                "name": "level",
                "value": "={{ $json[\"level\"] }}"
              },
              {
                "name": "time_increment",
                "value": "={{ $json[\"timeIncrement\"] }}"
              },
              {
                "name": "limit",
                "value": "1000"
              },
              {
                "name": "action_attribution_windows",
                "value": "[\"1d_click\",\"7d_click\",\"1d_view\"] "
              },
              {
                "name": "time_range",
                "value": "={{ '{\"since\":\"' + $json[\"backfillSince\"] + '\",\"until\":\"' + $json[\"backfillUntil\"] + '\"}' }}"
              }
            ]
          }
        },
        "graphApiVersion": "v23.0"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "typeVersion": 1
    },
    {
      "id": "7cd31a88-2944-47ec-90b1-0978cfacffb3",
      "name": "Transform backfill data for Sheets",
      "type": "n8n-nodes-base.code",
      "position": [
        624,
        608
      ],
      "parameters": {
        "jsCode": "// Erwartet: items[] aus dem Facebook Graph API Node\n// Wir bauen eine flache Struktur pro Kampagne/Adset/Ad\n\nconst out = [];\n\nfor (const item of items) {\n  // Meta liefert die Ergebnisse in item.json.data als Array\n  const dataArray = Array.isArray(item.json.data) ? item.json.data : [];\n\n  for (const s of dataArray) {\n    const row = {};\n\n    // Basisinfo & Struktur\n    row.date = s.date_start || s.date_stop || null;\n    row.account_id = s.account_id || null;\n    row.account_name = s.account_name || null;\n\n    row.campaign_id = s.campaign_id || null;\n    row.campaign_name = s.campaign_name || null;\n    row.objective = s.objective || null;\n\n    row.adset_id = s.adset_id || null;\n    row.adset_name = s.adset_name || null;\n    row.ad_id = s.ad_id || null;\n    row.ad_name = s.ad_name || null;\n\n    row.publisher_platform = s.publisher_platform || null;\n\n    // Standardmetriken\n    row.impressions = Number(s.impressions || 0);\n    row.reach = Number(s.reach || 0);\n    row.frequency = Number(s.frequency || 0);\n    row.spend = Number(s.spend || 0);\n    row.clicks = Number(s.clicks || 0);\n    row.inline_link_clicks = Number(s.inline_link_clicks || 0);\n    row.ctr = Number(s.ctr || 0);\n    row.cpc = Number(s.cpc || 0);\n    row.cpm = Number(s.cpm || 0);\n\n    // Actions & Values\n    const actions = Array.isArray(s.actions) ? s.actions : [];\n    const actionValues = Array.isArray(s.action_values) ? s.action_values : [];\n\n    const getAction = (type) => {\n      const f = actions.find(a => a.action_type === type);\n      return f ? Number(f.value || 0) : 0;\n    };\n\n    const getActionValue = (type) => {\n      const f = actionValues.find(a => a.action_type === type);\n      return f ? Number(f.value || 0) : 0;\n    };\n\n    // Konversionsmetriken f\u00fcr diverse Ziele\n    row.leads = getAction('lead');\n    row.on_facebook_lead = getAction('onsite_conversion.lead_grouped');\n\n    row.purchases = getAction('purchase');\n    row.purchase_value = getActionValue('purchase');\n\n    row.add_to_cart = getAction('add_to_cart');\n    row.initiate_checkout = getAction('initiate_checkout');\n\n    // Abgeleitete KPIs\n    row.cpl = row.leads > 0 ? row.spend / row.leads : null;\n    row.cpa = row.purchases > 0 ? row.spend / row.purchases : null;\n    row.roas = row.purchase_value > 0 && row.spend > 0\n      ? row.purchase_value / row.spend\n      : null;\n\n    out.push({ json: row });\n  }\n}\n\nreturn out;"
      },
      "typeVersion": 2
    },
    {
      "id": "f95c9a19-0a11-4d62-bcff-721e39c546a1",
      "name": "Append backfill rows to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        848,
        608
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "account_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "account_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "account_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "account_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "platform",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "platform",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "campaign_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "campaign_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "campaign_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "objective",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "objective",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "adset_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "adset_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "adset_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "adset_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ad_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ad_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "impressions",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "impressions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reach",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "reach",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "frequency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "frequency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "spend",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "spend",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "clicks",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "clicks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "inline_link_clicks",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "inline_link_clicks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ctr",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ctr",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpc",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpc",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpm",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpm",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "leads",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "leads",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "on_facebook_lead",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "on_facebook_lead",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchases",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "purchases",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purchase_value",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "purchase_value",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "add_to_cart",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "add_to_cart",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "initiate_checkout",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "initiate_checkout",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpl",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpa",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "cpa",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "roas",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "roas",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set backfill config').item.json.sheetNameData }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set backfill config').item.json.sheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e6f9ef37-5f6a-4171-9016-fabc472c85cf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -384
      ],
      "parameters": {
        "width": 608,
        "height": 1008,
        "content": "## Meta Ads \u2192 Google Sheets: Daily & Historical Campaign Performance\n\n### Who is this for?\n- Meta / Facebook Ads managers\n- Performance marketers and agencies\n- Ecommerce businesses  \n- Anyone who wants clean, daily campaign data in Google Sheets for dashboards and analysis\n\n### What this workflow does\n- **Daily export** of Meta Ads campaign performance to a Google Sheet (one row per campaign per day).\n- **Manual backfill** of historical performance using the Insights `time_range` parameter (e.g. last 12\u201324 months).\n- Calculates key KPIs like **CPL, CPA, ROAS, frequency** for mixed objectives (traffic, leads, purchases).\n\n### How it works (high level)\n1. **Daily schedule (06:00)** triggers the *Daily Incremental* flow.\n2. The workflow calls the **Meta Insights API** at campaign level and flattens the response.\n3. Each campaign-day row is appended to a **Google Sheet** (e.g. `Meta_Daily_Data`).\n4. The **Manual Backfill** section lets you run the same logic on larger time ranges on demand.\n\n### \u26a0\ufe0f Important: Google Sheets Setup\nBefore running the workflow, open your Google Sheet and **add a header row** with the following column names: `date | account_id | account_name | publisher_platform | campaign_id | campaign_name | objective | adset_id | adset_name | ad_id | ad_name | impressions | reach | frequency | spend | clicks | inline_link_clicks | ctr | cpc | cpm | leads | on_facebook_lead | purchases | purchase_value | add_to_cart | initiate_checkout | cpl | cpa | roas`\n\n### How to use\n1. Open the `Set config` nodes (daily + backfill).\n2. Replace the example `adAccountId`, `sheetId`, and optional `sheetName` values with your own.\n3. Make sure your **Facebook Graph API** and **Google Sheets** credentials are configured.\n4. Run the **Manual Backfill** once if you need history, then enable the **Daily schedule**.\n5. Enable the workflow so the **Daily Export** runs automatically at 05:00.\n\n> Tip: Use this sheet as a data source for Looker Studio, Power BI, or Excel dashboards."
      },
      "typeVersion": 1
    },
    {
      "id": "52336ebe-6309-414d-b76e-9e83e1bcde25",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        640
      ],
      "parameters": {
        "color": 6,
        "width": 608,
        "content": "## Need help?\n\nFor help with **ecommerce**, **digital marketing**, or **data & analytics** setups based on this workflow:\n\n\ud83d\udc49 [Serendipity Technologies](https://www.serendipity.at)"
      },
      "typeVersion": 1
    },
    {
      "id": "4e9920d6-47ee-4bb4-8919-3adfe64f7e1a",
      "name": "Daily schedule (06:00)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 6
            }
          ]
        }
      },
      "notesInFlow": false,
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "97d0798f-100d-4590-abfd-60a821662837",
  "connections": {
    "Set backfill config": {
      "main": [
        [
          {
            "node": "Fetch Meta Insights (time_range)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily schedule (06:00)": {
      "main": [
        [
          {
            "node": "Set config (Meta + Sheets)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual backfill trigger": {
      "main": [
        [
          {
            "node": "Set backfill config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set config (Meta + Sheets)": {
      "main": [
        [
          {
            "node": "Fetch Meta Insights (yesterday)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform Meta data for Sheets": {
      "main": [
        [
          {
            "node": "Append daily rows to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Meta Insights (yesterday)": {
      "main": [
        [
          {
            "node": "Transform Meta data for Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Meta Insights (time_range)": {
      "main": [
        [
          {
            "node": "Transform backfill data for Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform backfill data for Sheets": {
      "main": [
        [
          {
            "node": "Append backfill rows to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

This template automatically exports Meta (Facebook) Ads campaign performance into Google Sheets — both daily and for historical backfills. It’s ideal for performance marketers, agencies, and analytics teams who want a reliable data pipeline from Meta Ads into their reporting…

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

More Marketing & Ads workflows → · Browse all categories →

Related workflows

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

Marketing & Ads

This n8n workflow automates the process of finding ecommerce seller leads, enriching them with product and business details, discovering company websites, and extracting contact information such as em

Google Sheets, N8N Nodes Mrscraper, HTTP Request
Marketing & Ads

This template is for B2B sales teams, SDRs, growth marketers, and founders who maintain a spreadsheet of prospects and need verified contact details -- emails and mobile numbers -- without manual rese

Google Sheets, HTTP Request
Marketing & Ads

This workflow finds local businesses from Google Maps and automatically enriches them with emails, social profiles, AI summaries, and personalized outreach messages — all saved to Google Sheets. Searc

HTTP Request, Google Sheets
Marketing & Ads

This workflow leverages n8n to perform automated Google Maps API queries and manage data efficiently in Google Sheets. It's designed to extract specific location data based on a given list of ZIP code

Execute Workflow Trigger, Stop And Error, HTTP Request +1
Marketing & Ads

This repository contains an SLA-based lead routing workflow built in n8n, designed to ensure fast lead response, fair sales distribution, and controlled escalation without relying on a full CRM system

Form Trigger, Google Sheets, Slack +1