I'm working with getting crypto pricing on my google sheet but I keep getting an error message. I've looked around and haven't really come across anything for CoinGecko. Below is the error message. "Exception: Request failed for https://api.coingecko.com returned code 429. Truncated server response: error code: 1015 (use muteHttpExceptions option to examine full response) (line 843).".
Here is the code starting line 843 to 865
var res = await UrlFetchApp.fetch(url);
var content = res.getContentText();
var parsedJSON = JSON.parse(content);
var data=[]
if (type=="price"){
for (var i = parsedJSON['prices'].length - 1; i >= 0; i--) {
data.push([toDateNum(parsedJSON['prices'][i][0]),parsedJSON['prices'][i][1]]);
};}
else if (type=="volume")
{ for (var i = parsedJSON['total_volumes'].length - 1; i >= 0; i--) {
data.push([toDateNum(parsedJSON['total_volumes'][i][0]),parsedJSON['total_volumes'][i][1]]);
};}
else if (type=="marketcap")
{ for (var i = parsedJSON['market_caps'].length - 1; i >= 0; i--) {
data.push([toDateNum(parsedJSON['market_caps'][i][0]),parsedJSON['market_caps'][i][1]]);
};}
else
{ data="Error";}
if (data!="Error")
cache.put(id_cache, JSON.stringify(data),expirationInSeconds);
return data;
Any insight would be great. Here's the link to the GS to see entire code in apps script.https://docs.google.com/spreadsheets/d/1Jtfcw7qLWbMcHfSWfJcExBVo3DRI1iP74wPBdPeybWA/edit#gid=388229362