I've finally connected via OAuth2 to pull a JSON of a performance report (of shares) and I'm wondering how I can load this object into Google Sheets so it's in a matrix format?
{
"id": "ID-23035",
"total_gain": 11795.72,
"holdings":
[
{
"symbol": "APX",
"total_gain": 11525.72,
},
{
"symbol": "MP1",
"total_gain": 270,
}
]
}
The whole JSON is stored in a report object.
I know how to extract the 'id' and the 'total gain' from the 1st two rows, using:
var id= report_data.id
var total_gain = report_data.total_gain
However I'd like to take the holdings component, i.e.
var holdings = report_data.holdings
And then import it into Google Sheets in a matrix style table - to make it look like:
|-----symbol-----|----total gain-----|
|------APX-------|-----11525.72------|
|------MP1-------|--------270--------|
Is there some sort of code/function/script that can loop through and create this matrix/table? I'm guessing Google App Script uses JavaScript?