javascriptjsongoogle-apps-scriptalpha-vantage

Google sheet and Script editor under debug returns different resut


I am using Google Sheet to retrieve information from Alpha Vantage. If I run the below code under debug and inspect variable v, v has the data that I want.

If I call the function in a sheet, it return "Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day...." which imply that I have called function more often than I am allowed to.

I have tried this multiple times. I always get the right results in debug and wrong result in the sheet. Any suggestion?

function AVFunction()
{
  var func="OVERVIEW"
    var query="AAPL"  
    var v= AVImportJSON(func,query,"");
    return v;  // <-breakpoint
}

AVImportJSON is a wrap that eventually uses the code from http://blog.fastfedora.com/projects/import-json

Edit: There is only one cell that call the function.


Solution

  • It appears that Google Sheet would call a function multiple time. With a call limit of 5 calls per min, using function in Google Sheet to access Alpha Vantage does not seems to be a good solution.