Search API Connector Documentation

Print

Import Facebook Leads to Google Sheets

In this guide, we’ll walk through how to pull Facebook leads from the Facebook API directly into Google Sheets, using the API Connector add-on for Google Sheets.

This API supports authentication via OAuth2, so we’ll be connecting using API Connector’s preset integration for Facebook Pages (this is a paid feature, please install API Connector for a free trial or upgrade to access).

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the Facebook Pages API

If you haven’t connected API Connector to Facebook Pages before, you’ll first need to initiate the connection as follows:

  1. Open up Google Sheets and click Add-ons > API Connector > Manage Connections.
  2. In the list of available connections, find Facebook Pages and click Connect.
    fb-page-connect-img1
  3. You’ll be asked which Pages to connect. Click through to connect your account.
    fb-page-connect-img2
  4. You’ll then be returned to your Google Sheet, and can verify that your Facebook Pages connection is active in the Connections screen.
    fb-page-connect-img3

Part 2: Get Your Facebook Page ID

We’ll need your Facebook Page ID for subsequent requests, so let’s get it now.

  1. In API Connector, click Add New or Create to access the Create screen, and enter the following URL into the API URL path field:
    https://graph.facebook.com/v11.0/mixedanalytics
    Where it says mixedanalytics, enter in your own page name instead. You should see your page name in the URL bar when you open up your Facebook page.
  2. From the OAuth dropdown, choose Facebook Pages.
  3. Choose a destination sheet and request name
  4. Click Run to see your Facebook page ID
    fb-page-connect-img4

Facebook used to provide your Page ID on the About section of the page, but it seems like they’ve removed that in the newest version. Therefore, if you have any trouble with the above steps, please get your Facebook Page ID from your Facebook Business Manager account instead.
fb-page-connect-img5

Part 3: Get your Facebook Form ID

Now that we have a Facebook Page ID, let’s get the lead generation Form ID associated with that Page.

  1. In API Connector, click Add New or Create to access the Create screen, and enter the following URL into the API URL path field:
    https://graph.facebook.com/v11.0/507738226062106/leadgen_forms?fields=id,locale,name,status,created_time,expired_leads_count,leads_count,organic_leads_count,page,page_id
    Where it says 507738226062106, enter in your own page ID instead.
  2. From the OAuth dropdown, choose Facebook Pages.
  3. Choose a destination sheet and request name
  4. Click Run to see your form ID(s).
    fb_leads_img6

Part 4: Pull Facebook Leads into Google Sheets

We’re now ready to get those leads!

  1. Back in the Create tab, enter the following URL:
    https://graph.facebook.com/v11.0/262036722404505/leads?fields=created_time,id,form_id,field_data
  2. Where it says 262036722404505, substitute in your own form ID. This should be the form that you want to retrieve leads from.
  3. From the OAuth dropdown, choose Facebook Pages.
  4. Choose a destination sheet and request name
  5. Click Run to see your leads.
    fb_leads_img7
Facebook only provides leads data for up to 90 days from the time the form is submitted (info). Therefore you may find that your available leads are lower than your total lead counts. For this reason, it’s best to download your leads data often to avoid losing access to your data.
Previous Import Facebook Ad Data to Google Sheets
Next Import Facebook Page Data to Google Sheets

Leave a Comment

Table of Contents