-1

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.

Leon
  • 33
  • 1
  • 1
  • 6
  • I’m guessing you use this as a custom function inside a cell and every cell creates a separate call so if you use it in too many cells you can easily generate too many calls . Well you may have never exceeded 500 calls in the day if you exceed more than one call every 12 seconds then you’ve exceeded the daily rate that’s how Google measures or calls that’s probably how they’re doing it too – Cooper Mar 30 '21 at 15:27
  • Show how are you calling the function in a sheet. Is this done only once or multiple times? Also add the textual error message logged in the executions page (include filename and line number) Ref. [mcve]. – Rubén Mar 30 '21 at 15:47
  • @ Cooper: I have only one cell that call the function. When the cell did not return the expected result, I go back to the editor and inspect variable v, and again it gives the right result. I repeat this process multiple time, and every time inspect variable v in the editor gives the right results, and every time the function in the scripe returns the error msg. – Leon Mar 31 '21 at 01:17
  • @Rubén. I type '=AVFunction()' in a cell. Sorry, I do not understand what do you mean by "Also add the textual error message logged in the executions page (include filename and line number)", This is not my original function but a reduced version that can show the issue. – Leon Mar 31 '21 at 01:23

1 Answers1

0

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.

Leon
  • 33
  • 1
  • 1
  • 6