Search API Connector Documentation
Import LinkedIn Pages Data to Google Sheets
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.
- Before You Begin
- Part 1: Connect to the LinkedIn Pages API
- Part 2: Create a LinkedIn API Request URL
- Part 3: Pull LinkedIn Page Data into Sheets
- Part 4: Example with Date Parameters
- Part 5: More Example API URLs
- Part 6: Notes
- Part 7: API Documentation
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:
- Open up Google Sheets and click Extensions > API Connector > Manage Connections.
- In the list of available connections, find LinkedIn Pages and click Connect.
- You will be directed to LinkedIn and asked to authorize the connection. Click Allow.
- 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.
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.
Part 3: Pull LinkedIn Page API Data into Sheets
Now let’s copy that URL into API Connector.
- In the Create Request interface, enter the Request URL we just created.
- Under OAuth, choose LinkedIn Pages. You should see a “connected” badge.
- We don’t need any headers for this API, so just leave that section blank.
- Create a new tab and click Set current to use that tab as your data destination.
- 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.
- 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).
- 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
- Now open the API Connector sidebar, and create a request that references the cell containing UNIX timestamps, like this:
- 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.
- 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):
- 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: More Example API URLs
- Look up organizations by their vanity name
- Look up organizations by email domain
- Get follower statistics
- Get share statistics
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