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

The easiest way to get started with the LinkedIn Pages API is through API Connector’s built-in integration.

  1. Select LinkedIn Pages from the drop-down list of applications
    linkedinpages-application
  2. Under Authorization, click Connect to LinkedIn Pages
    linkedinpages-authorization
  3. You will be directed to LinkedIn and asked to authorize the connection. Click Allow.
    linkedinpages-allow
  4. You’ll now be returned to your Google Sheet, and can verify that your LinkedIn API connection is active.

Part 2: Get your Organization ID

Get your organization ID by looking in the URL while logged into your LinkedIn company page.
linkedin-pages-orgid

Note this ID as we’ll need it for our requests.

Part 3: Pull Data from LinkedIn Pages to Sheets

Now that we’re connected, let’s pull some data into Sheets.

  1. Under Endpoint, choose /organizationPageStatistics?q=organization. This will return pageview stats about your organization’s LinkedIn page.
    linkedinpages-endpoints
  2. The first required parameter is organization. Enter your organization ID using this exact syntax: urn%3Ali%3Aorganization%3A6447845.
    linkedinpages-parameter-organization
  3. The other required parameter is timeIntervals. Choose a start and end date, as well as a time breakdown (day or month).
  4. Select a destination sheet, name your request, and click Run. A moment later you’ll see a lot of information about your LinkedIn page populate your sheet. This report contains pageviews broken down by multiple facets (device, industry, etc).
    linkedinpages-response
  5. 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: Handle Dates

The LinkedIn Pages API uses UNIX timestamps. Here’s how to see “standard” dates in your sheet instead.

  1. Set your destination cell to B1. This will give us space in column A for a formula
    linkedin-pages-startcell
  2. 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),""))
  3. 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).

Part 5: Create a Custom Request

Alternatively, you can create a custom request instead of using API Connector’s built-in integration, using any of the endpoints and parameters shown in the documentation.

To create a custom request, add the complete URL into the request URL field, and select LinkedIn Pages from the OAuth menu. In addition, add a custom Header where Key =X-Restli-Protocol-Version, Value = 2.0.0.

To easily convert from a preset request to a custom API URL, tick the Add request URL box before running your preset request (under Output options). This will print out your complete API URL, which you can then copy/paste into the request URL field.

Part 6: API Documentation

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

To view or manage the API Connector connection on LinkedIn’s side, click this link: https://www.linkedin.com/psettings/permitted-services

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

4 thoughts on “Import LinkedIn Pages Data to Google Sheets”

  1. Hello Ana,

    I’d like to create triggers for LinkedIn Pages requests to run daily. Is there a way to set a dynamic date range (always yesterday) for these requests? And if so, is it necessary to create a custom request or can it be done directly in LinkedIn Pages?

    Greetings and thanks.

    Reply
    • Hey Luis, for now you need to do this as a custom request. I think the easiest way will be to set up your request using the LinkedIn Pages preset connection, then tick the “Add request URL” option under Output options > More options before you run it. That way you can see your whole request URL and copy/paste it into a custom request. Then instead of hard-coding in the dates, reference cells containing dynamic dates as described here. That article has an example of how to include dynamic dates in your request.

      Reply
    • Good question. Unfortunately the LinkedIn API is really lacking in functionality (and documentation). You can get a list of posts using a request URL like this:
      https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A6447845)&sortBy=LAST_MODIFIED&count=100. However that list doesn’t come back with any useful engagement data, and their documentation doesn’t seem to indicate that this data is available. I’ll update this post if I find anything different.

      Reply

Leave a Comment

Table of Contents