With Sheetgo, you can seamlessly connect your Facebook Ads account to Google Sheets, enabling you to import campaign performance data directly from the Facebook Marketing API. This integration allows you to automatically pull insights such as impressions, clicks, costs, and conversions. By automating this data flow, marketing teams can centralize ad analytics, track KPIs in real time, and generate dynamic performance dashboards without manual exports or third-party connectors.
Prerequisites
- A Facebook for Developers account.
- A Facebook App created in your developer dashboard.
- A valid Access Token (preferably a long-lived one).
- Facebook Marketing API documentation: https://developers.facebook.com/docs/marketing-apis/
- Facebook Access Token Tool: https://developers.facebook.com/tools/access_token/
- Sheetgo API Connect documentation
Step 1: Identify the Required API Endpoint
To retrieve advertising data, navigate to the Facebook Marketing API documentation linked in the Prerequisites section. Under the "Ad Insights" section, you'll find several available endpoints for accessing campaign performance metrics. The most common GET endpoint is /act_{ad-account-id}/insights, which returns aggregated insights for ads, ad sets, and campaigns.
The base URL for the Facebook Graph API is https://graph.facebook.com/v25.0. Combine this base URL with your specific ad account ID and endpoint to form your complete request URL, such as https://graph.facebook.com/v25.0/act_{ad-account-id}/insights.
Step 2: Generate API Credentials
To authenticate your request, you'll need a valid Facebook access token. Log into your Facebook Developer account, navigate to the Graph API Explorer, and generate a User Access Token with the necessary ads_read permission. For long-term use, exchange this short-lived token for a long-lived one using the endpoint provided in the Facebook documentation linked in the Prerequisites. Copy and securely store the token, as it will be used in your Sheetgo connection header for authorization.
Step 3: Open the Sheetgo API Connector
Log in to Sheetgo and open an existing workflow or create a new one. Click on Connect and choose API Request under Data Source. Then select HTTP Request as the method type. You'll be prompted to enter the API URL and configure authentication and headers.
Step 4: Configure the API Request in Sheetgo
Open your Sheetgo workspace and create a new workflow. Under the source, select "HTTP Request" and paste your API URL (e.g., https://graph.facebook.com/v25.0/act_{ad-account-id}/insights?fields=campaign_name,impressions,clicks,spend). In the Headers (JSON) section, insert the following JSON configuration, which includes pagination and refresh token support for OAuth2 authentication if needed:
{ "Authorization": "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json", "@pagination": { "type": "cursor", "cursor_param": "after", "next_cursor_key": "paging.cursors.after", "has_more_key": "paging.next" }, "@refresh_token": { "auth_method": "oauth2", "auth_type": "Bearer", "refresh_url": "https://graph.facebook.com/oauth/access_token", "refresh_params": { "grant_type": "fb_exchange_token", "client_id": "YOUR_APP_ID", "client_secret": "YOUR_APP_SECRET", "fb_exchange_token": "YOUR_SHORT_LIVED_TOKEN" } }}
Step 5: Choose the Destination Spreadsheet
Once your request and headers are configured, select your destination file in Google Sheets. You can either create a new spreadsheet or select an existing one where you'd like the Facebook Ads data to be stored. Ensure the spreadsheet name and tab are clearly labeled (e.g., "FB_Ads_Insights") to keep your data organized for future updates.
Step 6: Execute the Sheetgo Automation
Click Run to execute your first data retrieval. Sheetgo will connect to the Facebook Ads API, extract the insights data, and populate your selected spreadsheet. To maintain up-to-date analytics, schedule automatic refreshes within Sheetgo. Depending on your workflow setup, this can be hourly, daily, or weekly, ensuring your ad performance dashboards always reflect the latest data.
