LinkedIn Ads are paid advertisements on LinkedIn. We can use the LinkedIn API to import campaign 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:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser:
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 Advertising API and agree to the terms.
Next, complete the MDP Access Form, which is available in the Developer Portal under My Apps > Products. Click the Access request 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/rest/ 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:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your LinkedIn Ads API endpoint. For this example, we are using the GET method.
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
Replace your_token with the value of the token you obtained previously, in Step 4. There should be a literal space between Bearer and 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.
That’s it! You’ve successfully connected your LinkedIn Ads account to Google Sheets using the LinkedIn Ads API, Google Sheets API, and the Apipheny add-on.
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.
Schedule requests for automatic updates
Reference cell values in requests
Stack multiple URLs in a single request
Run all saved requests at once
Crypto API tutorials and more: