Print

Import Mailchimp Data to Google Sheets

In this guide, we’ll walk through how to pull data from the Mailchimp API directly into Google Sheets, using the API Connector add-on for Google Sheets.

There are 2 ways to connect to the Mailchimp API:

  • Preset "Connect" button (OAuth)
  • Personal API key. Please check the appendix for detailed instructions to retrieve your key.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the Mailchimp API

The easiest way to get started with the Mailchimp API is through API Connector’s built-in integration.

  1. Select Mailchimp from the drop-down list of applications
    mailchimp-application
  2. Under Authorization, click Connect to Mailchimp
    mailchimp-authorization
  3. You will be asked to authorize the connection. Click Allow.
    mailchimp-img2
  4. You’ll then be returned to your Google Sheet, and can verify that your connection is active.

Part 2: Pull Data from Mailchimp to Sheets

Now that we’re connected, let’s pull some data into Sheets.

  1. Under Endpoint, choose an endpoint. Let's start with /lists.
    mailchimp-endpoints
  2. Enter your data center. To get your data center, check the URL when you're logged in to your Mailchimp account. In this example, the data center would be us20.
    mailchimp-api-img4
  3. There are no other required parameters for this endpoint, so just select a destination sheet, name your request, and click Run. Note the lists.id value as you can plug that into the /lists/{list_id}/members endpoint to fetch the members of that list.
    mailchimp-response

Part 3: Create a Custom API Request

Alternatively, you can create a custom request instead of using API Connector’s built-in integration, using any of the endpoints and parameters shown in the API documentation. Here's an example request setup, just substitute in your own datacenter and list IDs.

  • ApplicationCustom
  • MethodGET
  • Request URLhttps://us20.api.mailchimp.com/3.0/lists/32d8e317e4/members
  • OAuthMailchimp (or connect with a key)

Part 4: Handle Pagination

Note Mailchimp’s limits on the number of records returned on a response. By default, only 10 records will be returned unless you use the ‘count’ and ‘offset’ parameters as described in their documentation.

mailchimp-api-img8

With API Connector, you can either set these up as separate requests or loop through them automatically with pagination handling (paid feature):

  • Offset parameter: offset
  • Limit parameter: count
  • Limit value: 1000
  • Run until: choose when to stop fetching data
    mailchimp-pagination-offsetlimit

Part 5: API Documentation

Official API documentation: https://mailchimp.com/developer/marketing/api/

To view/remove the connection on Mailchimp's side, follow the instructions here: https://mailchimp.com/help/remove-an-application-from-your-account/

Appendix: Connect with an API Key

  1. As an alternative to using the preset OAuth integration, you can connect with an API key. Log into your Mailchimp account and navigate to the API Keys section (or just click this link: https://us1.admin.mailchimp.com/account/api/)
  2. Click the Create A Key button
    mailchimp-api-img1
  3. You'll now see your API key listed in a section titled "Your API keys"
    mailchimp-api-img2
  4. To use, under Headers, enter Authorization as your Key, and apikey YOUR_API_KEY as your Value, like this. Keep OAuth set to None as you're authorizing with an API key instead.
    mailchimp-img9

22 thoughts on “Import Mailchimp Data to Google Sheets”

  1. Super product, kudos! Is there a possibility to work with arrays such as are provided through e.g. this (in emails >> activity): https://usXX.api.mailchimp.com/3.0/reports/[campaign_id]/email-activity?count=500&fields=emails.campaign_id,emails.list_id,emails.email_address,emails.activity.timestamp,emails.activity.action,emails.activity.url,emails.activity.type

    Reply
  2. This is great!

    Is there a more efficient way to retrieve data count with 60,000 + rows rather than running the api request 65 times?

    Reply
    • I didn't know that, but just checked and confirmed that poll data doesn't seem to be available in the API. That's unfortunate. Thanks for letting me know.

      Reply
    • This error means there's an incorrect value into the Header field. Can you please make sure you haven't included any typos or extra spaces at the beginning or end? If you'd like me to take a look, please feel free to message me a link to your sheet.

      Reply
    • Are survey results the same as poll results? If so, someone in the comments noted that this isn't available via the API (you can see some more info on this here).

      Reply
  3. Thanks Ana.

    Thanks for your quick reply 🙂
    I already saw this info, but as it dated from 2018, I had hoped that Mailchimp had evolved in the meantime. So, it is not the case 🙁

    From my point of view, a poll is inside emails and his results are values 0-10. The survey is done via a separate form, with others questions than having a answer 0-10: it could be radio-buttons, check-boxes…

    Kind regards,
    Michel.

    Reply
    • Thank you for letting me know! That's a shame, it was a useful tool. I've just updated the article to remove the link.

      Reply
    • When you run a query like https://us20.api.mailchimp.com/3.0/lists/32d8e317e4/members, it returns a field called "total_items" that contains the number of subscribers in the list.

      Reply
      • I'm not totally clear on the difference, but I'd just check some of their lists endpoints, one of them should have what you're looking for. For example their description for the /lists/{list_id} endpoint says "Get information about a specific list in your Mailchimp account. Results include list members who have signed up but haven't confirmed their subscription yet and unsubscribed or cleaned." Maybe that's what you're looking for?

Leave a Comment

Jump To