It looks like you're new here. If you want to get involved, click one of these buttons!
function fetchHoldings() {
var accessToken = PropertiesService.getScriptProperties().getProperty('ACCESS_TOKEN');
if (!accessToken) {
SpreadsheetApp.getUi().alert('❌ Access Token not found! Please login again.');
return;
}
// API URLs
var mfUrl = 'https://api.kite.trade/portfolio/mf/holdings'; // Mutual Fund holdings URL
var options = {
method: 'get',
headers: {
'X-Kite-Version': '3',
'Authorization': 'token ' + API_KEY + ':' + accessToken
}
};
try {
// Fetch mutual fund holdings
var mfResponse = UrlFetchApp.fetch(mfUrl, options);
var mfData = JSON.parse(mfResponse.getContentText());
if (mfData.status !== 'success') {
Logger.log("Didn't get it");
return;
} else {
Logger.log(mfData);
}