I am trying to make a google script which i want to use in Google sheets.
I followed a tutorial video on youtube and i had the idea that my script was working well.
But then two strange things happen, and i can't figure out why.
Below is my code, this code is exactly doing what i want.
It is showing the EPS of IBM in the google sheets and also in the log.
However the moment i change the APIkey from "demo" to my own APIkey it is not working anymore.
At that moment it is still showing the EPS in the LOG, but i will get an empty cell in Google Sheets.
I have no idea why that happens.
/**
* Imports api data from alphavantage
* @customfunction
*/
function apiav(a) {
var res = UrlFetchApp.fetch(
'https://www.alphavantage.co/query?function=OVERVIEW&symbol=IBM&apikey=demo'
);
var content = res.getContentText();
var json = JSON.parse(content);
var overviewvalue = json['EPS'];
Logger.log(overviewvalue);
return overviewvalue;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…