Rate limit when writing to Google Sheet?

Hi everyone

I have a flow that runs every hour, calculates the KWH used the last hour for a specific smart plug and what that cost was. Then it writes those values to Google Sheet.

However, upon inspecting my Google Sheet I can see that I have gaps - sometimes 5 hours missing.

After adding a failure notification I can see that the error I get is “Rate limited” (The timeline shows “Der kunne ikke gemmes data i Google Sheet. Fejlen er angivet til: Rate limited“) when trying to write to Google Sheet.

I have a couple of other flows that writes to other Google Sheets - but over an entire day these other flows would only try to write 7 times.

So I guess the question is, why am I getting the “Rate limited” error spread out across the day - with no specific time dominating and how do I avoid this?

Upon inspecting these other flows that write to Google Sheets I can see that they also have the same gaps (though they are daily flows, so these gaps are days missing) - so they are suffering from the same rate limit-issue.

I found this for google sheet API limits. The 429 means you are exceeding at least one of those at time of occurrence.

Type Scope Limit
Read requests Per minute per project 300
Per minute per user per project 60
Write requests Per minute per project 300
Per minute per user per project 60

Yes, I figured as much.

It just doesn’t make sense. And that is the reason for writing here - because I need an extra sanity check.

Since I am trying to write, I assume the rate limit is tied to the write request.

I have no flows that comes anywhere near those limits.

I am around 30 write request per day (24 of these are one hourly request) - and the rest (6-7) centered around 8 AM and 8 PM.

The only thing I can think of is Google Drive keeps warning me that I only have 3% left of available space (415 Mb still available)… I am wondering if Google has added some kind of throttling in instances where the available space is “close” (by their own definition) to the max.

Are there any insights available in Google for the API requests? That could help indicate the source of where the requests are coming from.

I had the same problem a few times a day when writing to Google Sheets every hour. I solved this by adding a wait time of 90 seconds and then writing to Google Sheets again.

Thanks! I will try to add a delay in that instance.

Will let you know how it goes.

Are you sure that it is possible to see this kind of data?

From what I understand the Google Sheets app in Homey only knows my Google user account.

It does not have access to any Google Cloud project that I own, so I can’t see how insights would be made available to me on the Google-side of the integration.

I don’t know, that’s why I asked it in the form of a question :slight_smile:

I was referring to some kind of Google insights around the API calls (Google is the one that determines the rate limit, maybe they’ve got some kind of overview of what’s being done and when) not Homey Insights.

I think I fixed it.

I added a timer for 90 seconds if the data upload to Google Sheet fails as you suggested.

As long as the upload fails the timer is restarted.

It looks like it usually succeeds in the second try.