Mailchimp is a a popular email marketing platform. With Mailchimp’s API, you can get data on your campaigns, ads, lists and audiences, reporting, and much more.
To pull data from Mailchimp into Google Sheets, first install and open the Apipheny Google Sheets add-on.
Apipheny is an API integrator for Google Sheets that you can use to connect to unlimited API data sources, make unlimited API requests, and more. Click here to learn more about Apipheny. There’s a 30-day free trial included then it’s $19-$29/month.
1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the next page: https://gsuite.google.com/marketplace/app/apipheny/966163326746
2. After you’ve installed Apipheny, open a Google Sheet and then click on Add-Ons in the top menu. Then, in the add-ons menu, you should see Apipheny. Just click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets:
1. In your Mailchimp account, click the arrow next to your account icon and select the Account option:
2. On the next page, in the menu, click Extras and then click API keys:
3. Next scroll down to the Your API keys section and click Create A Key:
4. Your API key should have been generated:
5. Enter a descriptive name for your API key by editing the Label field, so you know what application is using that key:
Finally, copy and paste your Mailchimp API key somewhere safe, as you will need it in the next steps.
In this section, we’ll show you how to browse the Mailchimp API documentation to create an API URL that retrieves the specific information you need from your Mailchimp account.
If you already know your Mailchimp API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the Mailchimp API documentation page: https://mailchimp.com/developer/reference/
The menu on the left contains a list of the available APIs, each with its own endpoints:
Clicking on an API scrolls to that API’s section, containing a list of associated endpoints. For instance, if you click the Campaigns API, the page will scroll to the list of its 3 endpoints: Content, Feedback, and Send Checklist.
All API calls to Mailchimp should be made to the root domain:
Mailchimp API base URL: https://<dc>.api.mailchimp.com/3.0/
One of the available endpoints is Content. If we use the Content endpoint, then our whole URL will look like this:
The <dc> part of the URL corresponds to the data center for your account. For example, if the last part of your Mailchimp API key is us4, all API endpoints for your account are available at https://us4.api.mailchimp.com/3.0/
Each endpoint’s documentation contains a short description, the HTTP method used (eg. GET) and the link you should append to the root API URL for querying this endpoint (eg. /contacts/v1/lists):
For endpoints that accept parameters, the documentation is where you would find them listed and explained, along with example inputs and responses.
Now you’re ready to enter your API request into your Google Sheet. Go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab (screenshot below).
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) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 3, we explained how you can find the Mailchimp REST API endpoint that you need and how to put your whole URL together. Now copy and paste your complete Mailchimp API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query (if applicable).
For this example, we are using the Lists API endpoint, to get all lists from our account:
Example Mailchimp API URL: https://us4.api.mailchimp.com/3.0/lists
Headers: In the Headers section in Apipheny, you’ll need one row with the following key and value:
Just copy and paste the key and value into Apipheny.
your_api_key is the value you generated previously, in Step 2. There should be a space between “Basic” and “your_api_key” (see screenshot).
Your last step is to click the Run button at the bottom of the Apipheny add-on and wait for the Mailchimp API data to be imported into your Google Sheet, like this:
After making a successful request to the Mailchimp API, try querying a different endpoint, or try using one of the more advanced features in the Apipheny add-on, such as: