I'm trying to utilize map function in Google SpreadSheets (Google Script) to get my account coin balances from Bittrex using API. Here is my JSON object:
({success:true,
message:"",
result:[
{Currency:"BTC",
Balance:0.01,
Available:0.01,
Pending:0,
CryptoAddress:null},
{Currency:"ETH",
Balance:1.0,
Available:1.0,
Pending:0,
CryptoAddress:null}
]}
})
Ideally I would like to populate header row automatically, based on Keys in result and underlying rows using data from each object. I saw spme solutions how to do that using for each or more complicated way. But I guess this can be done by just mapping. Here is how I mapped top row, but don't know how to map values:
var headerRow = Object.keys(json.result[0]);
Expected output in Google SpreadSheet is
____________________________________________________________
| Currency | Balance | Available | Pending | CryptoAddress |
|__________________________________________________________|
| BTC | 0.01 | 0.01 | 0 | null |
| ETH | 1.0 | 1.0 | 0 | null |
____________________________________________________________