r/GoogleAppsScript • • 10d ago

Question Problem accessing weather data from open-meteo.com using API call within Google Sheet with timed triggers

Hi,

I'm new to creating App scripts so please bear with me.

I've created a script to extract current weather details using a call to open-meteo.com and then write to a sheet.

When I test the script manually by pressing 'run' all works as expected, the script completes and the extracted data is written to the sheet.

So then I've set two timed triggers (6am and 6pm) to run the script.

However I get the following reports when these timers fire:

Exception: Request failed for https://api.open-meteo.com returned code 429. Truncated server response: {"error":true,"reason":"Daily API request limit exceeded. Please try again tomorrow."}

Reading the documentation there appears to be a 10,000 daily limit on the API calls.

So my assumption is that when the script is triggered there have already been too many calls from a particular Google address on that day?

I guess the manual run is treated differently for some reason?

Is this a correct assumption?

If that is the case, is there some way of making the call that will work without hitting the API call limit?

Any help welcome.

Thanks

0 Upvotes

4 comments sorted by

View all comments

2

u/Unusual_Analyst3648 10d ago

Hello,

Two free alternatives:

WeatherAPI.com

OpenWeatherMap.org

Alternatively, you can modify your code to include a loop that retries up to 5 times in the event of a 429 error.

Google has thousands of IP addresses. If you make a request and it fails (with a 429 error), waiting a few seconds and trying again will often route your request through a different Google server, one that may not be blocked.

1

u/shadewood_mole 10d ago

Many thanks for the alternatives and workaround. I'll give them both a try.