Import Matomo Data to Google Sheets

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

We'll first get an API token from Matomo, and then set up a request to pull in data from Matomo to your spreadsheet.


Before You Begin

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

Part 1: Get Your Matomo API Token

  1. Log in to Matomo and click on the Administration gear in the main menu.
  2. In the Admin menu, click Personal > Security
  3. At the bottom of the page click Create New Token
  4. Describe the purpose of our token (e.g. "get data in Sheets") and submit the form. You should now see a page containing your API token.
  5. Keep this token handy as you'll need it in a moment. Congrats! You're now ready to use the Matomo API.

Part 2: Pull Matomo API Data into Sheets

For this example, we'll get a list of visits by country. Where it says your_Matomo_domain, substitute in the location of your Matomo instance, e.g. if you self-host Matomo at, enter Enter in your own API token with it says your_token.

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodGET
    • Request URLhttps://your_Matomo_domain?module=API&method=UserCountry.getCountry&idSite=1&period=day&date=today&format=json&filter_limit=-1&token_auth=your_token
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run. A moment later you’ll see Matomo analytics data populate your sheet.

Check the documentation for the full list of available dimensions and metrics. Specify the data table using the method parameter. The Events methods accept an extra secondaryDimension parameter to fetch an extra event column, e.g. https://your_domain?module=API&method=Events.getCategory&secondaryDimension=eventAction&flat=1&idSite=1&period=month&date=today&format=json&filter_limit=-1&token_auth=your_token would retrieve a table of event categories and actions.

Part 3: API Documentation

Official API documentation:

2 thoughts on “Import Matomo Data to Google Sheets”

  1. Hi,

    I want to get monthly matomo data automatically importet per API.
    The API is working but I don´t get my data set automatically for the last month.

    Are there any ideas how to get it working. Thank a lot in advanced.

    The export url looks like this:


Leave a Comment

Jump To