Back to Blog

How to Import Facebook Ads to Google Sheets

How many campaigns do you have in your Facebook Ads Manager? We don’t have too many, but we still need to have their details in a spreadsheet to monitor the efficiency. For this, we’ve simply exported Facebook Ads data to Google Sheets. One way to do this is manual – export data as a CSV or Excel file and then upload the file to Google Sheets. Another way is to use Facebook API to auto-export data. Both options are described below.

Facebook Ads to Google Sheets – manual approach

Go to the Ads Manager and select the campaign(s) you want to export from Facebook. Click the Export & Import button and choose one of the three options:

  • All – to export data of all campaigns
  • Selected – to export data of the selected campaigns
  • Customize Export – to select the columns you want to export

If you’re in the expanded view, you’ll find the export functionality by clicking the More menu.

Once you click All or Selected (we chose Selected in our example), you’ll be asked to choose the format for the export file: Excel, CSV, or textual.

Click Export and a file will be downloaded to your device.

How to export from multiple Facebook Ad accounts at once

Having to manage multiple ad accounts can be a pain, but you can group the reporting process to export data from multiple Facebook Ad accounts at once. All you have to do is:

  • Select your accounts.
  • Choose a layout.
  • Configure the graph to show the requested data.
  • Click “Export” at the top right of the page.
  • Name your report, select your preferred format (CSV, PNG, XLS or XLSX), and click “Export”.

Now you have all the information available for multiple ad accounts, and you can analyze it collectively.

How to import Facebook Ads data to Google Sheets 

You can easily import a downloaded CSV or Excel file with your ad data into Google Sheets. All you have to do is open a Google Sheets document, go to File => Import, and upload the exported Facebook Ads file. For more on this, read How to manually import CSV data into Google Sheets from your device.

Here is how the exported ads data will look in Google Sheets:

This did not take much time, but the issue is that you have to repeat these steps manually every time. So, let’s check out how you can automate import of Facebook Ads to Google Sheets.

How to integrate Facebook Ads and Google Sheets for automatic data export

To set up a Facebook Ads connection to Google Sheets, you’ll need to complete two high-level steps:

  • Get a Facebook API access token
  • Connect Facebook Ads to Google Sheets

How to get a Facebook API access token 

Step 1: Create a Facebook App

Log in to your Facebook account. Go to https://developers.facebook.com/ and select My Apps.

Click Create App and select Manage Business Integrations. This type is for apps that allow you to manage Ads and ad-related assets. Click Continue.

In the open window, fill out the following fields:

  • App Display Name – enter the name you like
  • App Contact Email – specify the contact email address
  • App Purpose – select whether the app will access data from Facebook’s Platform on behalf of yourself (your business) or clients.
  • Do you have a Business Manager account? – select your business manager account from the dropdown list.

Click the Create App button and complete the Security Check.


Note: Use another browser or device to create an app if your security check window looks like this:


Step 2: Generate an Access Token

Once the app is created, you’ll be taken to the App Dashboard. Now go to Tools => Graph API Explorer.

Select the following parameters:

  • Facebook App – choose your created app
  • User or Page – choose Get User Access Token
  • Add a Permission – add ads_read permission (you’ll find it in Events Groups Pages) and other permissions you may need

Click Generate Access Token to link your app to Facebook and obtain the API token. Here is how it may look:

EAACZAWQDAhg31cHBrt4B7gPVxYNRCd6KZCEiCtqpSFFWNL90OLW5fuWM9VM13pD2csbZCDsg9RT5phztYwoZBRSBMjNE9sEXQeuAdKe2okZA9PrKvw9MzMSEs6qRsBAE5cJ26pRVAC41uVpIJ4aF2m1ThpJJQp4iyFnjEayZAYqNWNbx3YSrmvCcE9ZlZAhGbYf8OiUHK4gnzqZDZD

Warning: By default, the access token only lasts for one hour! 

How to extend the Facebook API access token
  • Click on the blue icon located next to the token, then click Open in Access Token Tool.
  • Click Extend Access Token and enter your Facebook password to confirm your intent.
  • Welcome a long-lived access token that will expire in 2 months.
  • Click Debug => This will get you back to the Access Token Debugger where you can copy your access token.

Connect Facebook Ads to Google Sheets

Coupler.io will help you bring your Facebook Ads data to Google Sheets. It is a solution for importing data to Sheets from different sources including apps (Airtable, Pipedrive, etc.) and online published files (CSV, Excel). Check out the list of available Google Sheets integrations

No installation is required. You just need to sign in, click the +Add New button and set up a custom integration. 

Set up a Facebook Ads Google Sheets integration

JSON Client

Coupler.io does not provide a ready-to-use Facebook Ads-Google Sheets integration yet, so we’ll set up a custom one using JSON Client importer that lets you connect to third-party apps using their APIs. Read more about how to import JSON to Google Sheets.

Name your importer what you like and select JSON Client as the source application from the dropdown list. Click Continue.

JSON URL

JSON URL is a request URL in the following format:

https://graph.facebook.com/{api-version}/{node}/{edge}

For example, 

  • {api-version}v9.0 is the latest API version as of this article. You can learn the API version in the Access Token Debugger.
  • {node} – nodes are individual objects, each with a unique ID. They represent the categories of data you can get. Here are the main root nodes for Facebook Marketing API:
NodeData entity
/{user}Data related to a specific user.
/act_{your-account-id}Data related to the business entity managing ads.
/{campaign-id}Data related to a specific ad campaign – contains one or more ad sets.
/{ad-set-id}Data related to a specific ad set – all ads that share the same budget, schedule, bid, and targeting.
/{ad-id}Data related to a specific ad.
  • {edge} – each node has its specific edge to return the requested data. For example, the node /{campaign-id} has the edge /ads, which returns data about creative elements and measurement information for an ad. Here is a list of node-specific edges you can use for data export.

JSON URL example for exporting a list of campaigns:

https://graph.facebook.com/v9.0/act_{your-account-id}/campaigns

You can find the ID of your account in the Ads Manager in the dropdown field. You can also copy the account ID from the URL bar. 

Once you’ve specified the JSON URL, click Continue.

URL query string

In the field, we need to specify the query string attached with the access token as follows:

access_token: {your-access-token}

Another important parameter is fields:

When you query a node, it returns a default set of fields, one or a few, but not all of them. In our example, to export a list of campaigns, there is only one default field – id. If we want other fields to be returned, we need to use the fields: parameter and list each field.

Example for exporting a set of fields for a list of campaigns:

fields: created_time,name,daily_budget

Note: You can learn the fields available to the node and edge you’re exporting in the Facebook Marketing API Reference. You can also add metadata:1 into the URL query string field when requesting a node (without an edge). This will return a list of fields available for the specified node.

Click Proceed to Destination Settings.

Destination

Select or add your destination Google account, click Continue, and select a spreadsheet, as well as the sheet to import Facebook Ads data to.

Click Proceed to Schedule Settings.

Automatic Data Refresh

You can automate the Facebook Ads data import on a custom schedule. To do this, toggle on Automatic data refresh and configure the schedule you want:

  • Interval – every hour, day or month
  • Days of week
  • Time preferences
  • Time zone

When you’re ready, click Save And Run to import your data. Once the import is completed, you can see the imported Facebook ads data. For this, click the Open button and the destination spreadsheet will open in a new tab of your browser.

Can I export Facebook Lead Ads to Google Sheets using JSON Client?

Unfortunately, you can’t do this. Facebook Lead Ads data contains personal information and requires pages_manage_ads or leads_retrieval permission for your FB app. To obtain the permission, your app should meet a number of requirements specified in Facebook regulatory documentation. 

However, you can still download Facebook Lead Ads manually from Ads Manager or your Facebook Page as a CSV or Excel file. We recommend you to download the file from the Ads Manager since it’s a shorter way. 

Select the ad for which you want to export leads data and click On-Facebook Lead (in the Results column).

Then select a date range and click Download. In the next window, you’ll need to click on the file format you want to download – CSV or XLS.

Nodes and edges for the Facebook Ads API to import data to Google Sheets

Node: /{user}

EdgeData entity
/adaccountgroupsGroup of Ad accounts associated with the user
/adaccountsAll Ad accounts associated with the user
/accountsAll pages and places that someone is an admin of
/promotable_eventsAll promotable events or promotable page events that belong to pages the use is an admin of
/promotable_domainsAll domains the user can promote

Node: /act_{your-account-id}

EdgeData entity
/campaignsData about campaigns’ objective and Ad sets
/adsetsData about Ads that share the same budget, schedule, bid, and targeting
/adsData for an Ad, such as creative elements and measurement information
/adcreativesAd’s appearance and content
/adimagesLibrary of images to use in Ad creatives
/advideosLibrary of videos to use in Ad creatives
/activitiesLog of actions taken on the Ad account
/adtagsSet of tags in the Ad account
/adcampaignconversionsConversion data aggregated by Ad sets
/adgroupconversionsConversion data aggregated by Ads
/customaudiencesCustom audiences
/generatepreviewsTo generate preview of an Ad
/offsitepixelsPixels associated with the account
/reachestimateTo generate the estimated reach of an Ad with a given targeting spec
/reportstatsAd account data 
/adcampaignstatsSet of statistics aggregated by Ad sets 
/adgroupstatsSet of statistics aggregated by Ads
/targetingsentencelinesTo generate human-readable description of targeting for the Ad set
/usersList of people associated with the account
/insightsData across child objects

Node: /{campaign-id}

EdgeData entity
/adsetsAds that share the same budget, schedule, bid, and targeting
/adsData necessary for an Ad
/adtagsTags for your campaigns
/insightsData across child objects

Node: /{ad-set-id}

EdgeData entity
/adsData necessary for an Ad
/adcreativesAd’s content and appearance
/activitiesLog of actions taken on the Ad set
/adtagsTags for your Ad sets
/conversionsConversion data for the Ad set
/insightsData across child objects

Node: /{ad-id}

EdgeData entity
/adcreativesAd’s content and appearance
/adtagsTags for your Ads
/conversionsConversion data for the Ad
/keywordstatsStats per targeted keyword for the Ad
/previewsTo generate Ad previews from the existing Ad
/reachestimateEstimated reach for the Ad
/targetingsentencelinesDescription of the targeting for the Ad
/insightsData across child objects

Do you need a Facebook Ads Google Sheets integration?

What is good about JSON Client by Coupler.io is that it lets you connect to different APIs and get data to Google Sheets without coding. However, not every user wants to tinker with the API documentation to get their job done. Besides, getting Facebook Lead Ads directly to Google Sheets may also be a wanted functionality. 

If you are one of those users and you’d like to have a Facebook Ads to Google Sheets integration, tell us about it by filling out this form. If it gets enough votes, we’ll develop a ready-to-use importer just like Shopify or Pipedrive. Good luck with your data!

Back to Blog

Comments are closed.

Access your data
in a simple format for free!

Start Free