Authentication Error using Google Sheets Import Script

Hi,

I’ve been trying to connect Matomo to Google Data Studio as described in the FAQ:

However, when I try to import the data using the script provided in the article, I get the following error in google sheets:

Error: You can’t access this resource as it requires ‘view’ access for the website id = 5.

Here’s the Export URL I’ve been using:

…/index.php?date=2021-01-07&expanded=1&filter_limit=10&force_api_session=1&format=CSV&idSite=5&language=en&method=Referrers.getReferrerType&module=API&period=day&token_auth=the_token&translateColumnNames=1&convertToUnicode=0

It works when I give view access to the anonymous user. I’ve also created a new user and given them view access but I got the same error using their token.

I had the same mistake while convert my excel data to google sheets. I’ll recomend you to look on this step-by-step guide https://blog.coupler.io/convert-excel-to-google-sheets/ to understand how you can do this.