I'm quite new to Scripts and coding and I'm stuck with a Balance Sheet JSON file from Alpha Vantage that I just can't seem to get into Google Sheets in usable format.
This is the code I currently have:
function get_Balance_Sheet(){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var Input = ss.getSheetByName("Input") var ticker = ss.getRange("A1").getValue(); var response = UrlFetchApp.fetch("https://www.alphavantage.co/query? function=BALANCE_SHEET&symbol="+ticker+"&apikey="+API_KEY+"&outputsize=compact"); var json = response.getContentText(); var data = JSON.parse(json); var BalanceS = ss.getSheetByName('BS data'); if(!BalanceS){ ss.insertSheet('BS data'); } var cell = BalanceS.getRange(1,1, data.length, data[0].length); cell.setValues(data);}
I know that I have to transpose the data somehow to have it look like an actual Balance Sheet, but I have no idea how this is supposed to work.
Hope anyone can help me and I've given enough information about my problem.