Search API Connector Documentation
Import LinkedIn Ads Data to Google Sheets
In this guide, we will pull data from the LinkedIn API directly into Google Sheets, using the API Connector add-on for Sheets.
The LinkedIn API is extremely limited and blocked off; don’t expect a way to pull out profile information for anyone but yourself. However, this API is perfect for pulling out advertising performance data from the LinkedIn Ads Reporting API.
- Before You Begin
- Part 1: Connect to the LinkedIn Ads API
- Part 2: Pull Data from LinkedIn Ads to Sheets
- Part 3: Create a Custom API Request
- Part 4: Handle Pagination
- Part 5: Notes
- Part 6: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the LinkedIn Ads API
The easiest way to get started with the LinkedIn Ads API is through API Connector’s built-in integration.
- Select LinkedIn Ads from the drop-down list of applications
- Under Authorization, click Connect to LinkedIn Ads
- 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.
Part 2: Pull Data from LinkedIn Ads to Sheets
Now that we’re connected, let’s pull some data into Sheets.
- Under Endpoint, choose
/adAccountsV2?q=search. This will return your account ID(s), which we can use in subsequent requests.
- There are no other required parameters for this endpoint, so just select a destination sheet, name your request, and click Run. The account IDs are listed in the
- Now select the
/adAnalyticsV2?q=analyticsendpoint to get reporting data in your sheet.
- Under Request parameters, add your account ID using this format:
List(urn%3Ali%3AsponsoredAccount%3A111111111). LinkedIn will only recognize this encoded value so copy and enter it exactly as written, substituting in your own account ID for
- Fill in the other required parameters:
timeGranularity. Optionally enter the text
projectionfield. This will retrieve some additional useful fields in the response.
- Run your request.
Part 3: Create a Custom API Request
Alternatively, you can create a custom request instead of using API Connector’s built-in integration. To create a custom request, add the complete URL into the request URL field, select LinkedIn Ads from the OAuth menu, and add a Header of Key =
X-Restli-Protocol-Version, Value =
To easily convert your preset request to a custom request, click Output Options > More Options > Add Request URL before running your request. This will print your URL into your sheet where you can copy/paste it.
Part 4: Handle Pagination
For certain endpoints, LinkedIn’s API limits response data as described here:
To use API Connector’s automatic pagination handling, use offset-limit pagination as follows
- Offset parameter:
- Limit parameter:
- Limit value:
- Run until: choose when to stop fetching data
Part 5: Notes
- Use the visual field editor to re-arrange columns (just click Edit Fields before running your request).
- LinkedIn sends back dates split into separate year, month, and day fields. To transform these into a regular Sheets date, set a data destination of cell B1, and then add the following function into cell A1:
=arrayformula(if(J2:J<>"", date(J2:J,H2:H,I2:I),"")). The function assumes years are in column J, months are in H, and days are in I; adjust as needed.
- To view or manage the connection on LinkedIn, click here: https://www.linkedin.com/psettings/permitted-services
Part 6: API Documentation
Official API documentation: https://docs.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting