问题
I'm trying to use an API from TD Ameritrade to load stock info into a Google Sheet.
I've tried the following code:
var ticker = "APPL"
var headers = {"Authorization":" Bearer <access token>"}
var options = {"headers":headers}
var calltoAPI=urlFetchApp.fetch("https://api.tdameritrade.com/v1/marketdata/"+ticker+"/quotes?apikey=<myapikey>",options);
I get the error: ReferenceError: urlFetchApp is not defined (line 6, file "Code"). However, in my developer app, I do get a return on APPL. Worth mentioning I'm not sure what belongs as the authorization Bearer access token and if that is the problem or part of a problem. I really don't know what to do next. The code was copied from this thread. I added my question there but it was deleted for not being helpful, so I'm asking you all instead.
来源:https://stackoverflow.com/questions/61314712/loading-stock-quotes-from-td-ameritrade-developer-app-into-sheets-with-google-sc