LinkedIn Ads are paid advertisements on LinkedIn. We can use the LinkedIn API to import data from LinkedIn Ads into Google Sheets. In this tutorial, I’ll show you how to connect the LinkedIn Ads API to Google Sheets in 7 steps:
To pull data from the LinkedIn Ads API to Google Sheets, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs, save API requests, schedule API requests, and more.
1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install.
2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the add-ons menu, you should see Apipheny.
Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.
In your Linkedin developer account, click the Create app button:
Complete all the required fields, such as App name, LinkedIn page and App logo:
Check the terms agreement checkbox and then click the Create app button:
Your app will then be created:
Select one of your apps then navigate to the Products tab. Select Marketing Developer Platform and agree to the terms.
Next, complete the MDP Access Form, which is available in the Developer Portal under My Apps > Products. Click the View access form link to start completing the form. Your application will not be reviewed until you complete the survey.
Complete all the required fields in the form:
Click the Submit button to finish and save the form:
A confirmation message will be displayed on the screen. Wait until your developer application has been given access to the Marketing Developer Platform:
Go to the LinkedIn Developer Portal, select the app you’ll be using, navigate to the Auth tab, and locate your Client ID and Client Secret. On the same page complete the Authorized redirect URIs for your app:
To proceed, you’re going to need to use a Postman account. If you don’t have one, you can sign up at www.postman.com. Open a new tab in Postman and navigate to Authorization. Change the “TYPE” to “OAuth 2.0” and then complete the fields from the Configure New Token section:
Fill out the form with the following values and click the Request Token button:
Postman will take you to the LinkedIn authorization page. You may be prompted to log into LinkedIn before getting to the below screen. Click the Allow button to authorize the request.
Postman will then display your access token. Copy it to a safe location, because you’ll need it later:
In this section, I’ll show you how to browse the LinkedIn Ads API documentation to find an API endpoint URL that retrieves the specific information you need from your LinkedIn account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 6.
First, open the LinkedIn Ads API documentation page: https://docs.microsoft.com/en-us/linkedin/marketing/
The menu on the left contains 5 main sections: Overview, Development, API Access, Integrations and Use Cases.
The available endpoints for this API are in the last two sections: Integrations and Use Cases.
If we expand these sections, a list of categories will be displayed for each one of them:
For instance, if we click the Campaign Management category, it will expand and other subcategories will be displayed. In this subcategory we click Account Structure and then Accounts. The endpoints from Accounts subcategory will be displayed on the main section of the page. Scroll down until you find the one you need.
In this case we chose the Fetch Ad Account endpoint.
The documentation for this endpoint contains a short description of the endpoint’s purpose, the HTTP method and URL, and a sample response:
All API calls for LinkedIn Ads should be made to the https://api.linkedin.com/v2/ base domain.
Okay, we’re in the home stretch. Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab. With the Import Tab open, enter these details into the add-on:
API URL: In Step 5, I explained how you can find the LinkedIn Ads API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path (JSON / CSV), followed by any GET parameters required for your query.
For this example, we are using the Me endpoint, which identifies and retrieves the current member’s profile based on the access token. The corresponding URL for this endpoint is:
Headers: In the Headers section of the Apipheny add-on panel, add one row, with the following key and value:
Header Key: Authorization Value: Bearer <your_token>
<your_token> is the value of the token you obtained previously, in Step 4. There should be a literal space between Bearer and <your_token>. Do not include the brackets “<>” around your token.
The last step is to click the Run button at the bottom of the Apipheny add-on and then your LinkedIn Ads data will be imported into your Google Sheet.
After making a successful request to the LinkedIn Ads API, try querying a different LinkedIn Ads API endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:
If you want to integrate your LinkedIn Ads data with Google Data Studio, just follow the same steps above and then connect your Google Sheet to your Google Data Studio report.