Search API Connector Documentation

Print

Import LinkedIn Pages Data to Google Sheets

premium

In this guide, we will pull data from the LinkedIn Organization (aka Pages) API directly into Google Sheets, using the API Connector add-on for Sheets.

With this connection you should be able to retrieve most of the metrics available to you when you click the Analytics tab while logged into the admin section of your LinkedIn company account. You can also access limited public data about other organizations.

Contents

Before You Begin

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

Part 1: Connect to the LinkedIn Pages API

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

  1. Open up Google Sheets and click Extensions > API Connector > Manage Connections.
  2. In the list of available connections, find LinkedIn Pages and click Connect.
    linkedin-pages-connect
  3. You will be directed to LinkedIn and asked to authorize the connection. Click Allow.
    linkedin-pages-oauth
  4. You’ll now be returned to your Google Sheet, and can verify that your LinkedIn API connection is active in the Connections screen.

Part 2: Create a LinkedIn API Request URL

For our first request, we’ll get some lifetime stats about your LinkedIn company page.

  • API root: https://api.linkedin.com
  • Endpoint: /v2/organizationPageStatistics
  • Parameters: ?q=organization&organization=urn:li:organization:6447845

Putting it together, we get the full API Request URL.

https://api.linkedin.com/v2/organizationPageStatistics?q=organization&organization=urn:li:organization:6447845

Where it says 6447845, substitute in your own organization ID. You can get your organization ID by looking in the URL while logged into your company page.
linkedin-pages-orgid

Part 3: Pull LinkedIn Page API Data into Sheets

Now let’s copy that URL into API Connector.

  1. In the Create Request interface, enter the Request URL we just created.
    linkedin-pages-url
  2. Under OAuth, choose LinkedIn Pages. You should see a “connected” badge.
    linkedin-pages-connected
  3. We don’t need any headers for this API, so just leave that section blank.
  4. Create a new tab and click Set current to use that tab as your data destination.
  5. Click Output options and choose “compact” report style for this report. This will both speed up the report processing time and make the report easier to read.
    linkedin-pages-reportstyle
  6. Name your request and click Run. A moment later you’ll see a lot of information about your LinkedIn page populate your sheet. By default, this report contains lifetime values broken down by multiple facets (device, industry, etc).
    linkedin-pages-results
  7. To filter for just the fields you need, click Edit Fields to open API Connector’s visual field editor. There you can filter out all the columns you don’t want to see in this report.

Part 4: Example with Date Parameters

The request above pulls in a massive data set of lifetime stats so most likely you’ll want to add time parameters. The LinkedIn Pages API uses UNIX date stamps so we’ll need a little bit of setup first.

  • Create a tab called Inputs. Add your date range into 2 cells, and convert those cells into Unix timestamps with the formula =(B1-DATE(1970,1,1))*86400*1000
    linkedin-pages-dates
  • Now open the API Connector sidebar, and create a request that references the cell containing UNIX timestamps, like this: https://api.linkedin.com/v2/organizationPageStatistics?q=organization&organization=urn:li:organization:6447845&timeIntervals.timeGranularityType=MONTH&timeIntervals.timeRange.start=+++Inputs!C1+++&timeIntervals.timeRange.end=+++Inputs!C2+++
    linkedin-pages-dates-url
  • Set your destination cell to B1. The response also comes back as UNIX timestamps, so this will give us space in column A to convert them back.
    linkedin-pages-startcell
  • Name your request and click Run. You should see your data broken out by month.
  • Add this formula into empty cell A2 (just change BR to whichever column contains elements.timeRange.start): =arrayformula(if(BR2:BR<>"",(BR2:BR/1000)/86400+date(1970,1,1),""))
  • You should now see your data broken down by human-readable dates (use Sheets’ built-in date format picker to select the exact format you want).
    linkedin-pages-dates-results

Part 5: More Example API URLs

  • Look up organizations by their vanity name
    https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=Google

  • Look up organizations by email domain
    https://api.linkedin.com/v2/organizations?q=emailDomain&emailDomain=linkedin.com

  • Get follower statistics
    https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:6447845

  • Get share statistics
    https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:6447845

Part 6: Notes

  • This integration pulls advertising data from LinkedIn’s Organization API into Google Sheets. It enables the following scopes: r_organization_social (Retrieve organizations’ posts, comments, and likes), rw_organization_admin (Manage organizations pages and retrieve reporting data.).
  • To view or fully remove the API Connector connection from LinkedIn’s side, click this link: https://www.linkedin.com/psettings/permitted-services

Part 7: API Documentation

Official API documentation: https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/page-statistics

Previous Import LinkedIn Ads Data to Google Sheets
Next Import Mailchimp Data to Google Sheets

Leave a Comment

Table of Contents