function TextSpacedAPICallTestingCenter()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var APIKey = sheet.getRange(1,2).getValue();
//var Authorization = "Bearer"+ APIKey
// Call the TextSpaced.com API to request system commodities list
var response = UrlFetchApp.fetch(BaseUrl+"/system/commodities",{ "headers":{"Authorization":"Bearer "+APIKey}});
// Parse the JSON reply
var json = response.getContentText();
var data = JSON.parse(json);
Logger.log(response.getContentText());
var fact = response.getContentText();
var sheet = SpreadsheetApp.getActiveSheet();
// functions above this line
var headerValue = "commodity_id";
var startRow = 2;
var endRow = startRow + headerValue.length - 1;
var column = 1;
var range = sheet.getRange(startRow, column, endRow, 1);
sheet.getRange(2,1).setValue([data.headerValue]);
}
JSON data:
{"commodity_id":13,"body_id":8263,"stock_amount":8263,"commodity_remaining":98201842,"commodity_maximum":98201950,"commodity_name":"Aluminium","commodity_short_name":"Al","commodity_illegal":false,"commodity_rarity":550,"commodity_category":1,"commodity_sub_category":13,"body_list":"Project 1","computed":{"can_mine":true}},"2":{"commodity_id":51,"body_id":8265,"stock_amount":8265,"commodity_remaining":983568,"commodity_maximum":1005361,"commodity_name":"Antimony","commodity_short_name":"Sb","commodity_illegal":false,"commodity_rarity":7,"commodity_category":1,"commodity_sub_category":15,"body_list":"Luminescent Planet","computed":{"can_mine":true}},"3":{"commodity_id":51,"body_id":8269,"stock_amount":8269,"commodity_remaining":779464,"commodity_maximum":779464,"commodity_name":"Antimony","commodity_short_name":"Sb","commodity_illegal":false,"commodity_rarity":7,"commodity_category":1,"commodity_sub_category":15,"body_list":"Chemical Planet","computed":{"can_mine":true}},"4":{"commodity_id":33,"body_id":8265,"stock_amount":8265,"commodity_remaining":4974627,"commodity_maximum":4974627,"commodity_name":"Arsenic","commodity_short_name":"As","commodity_illegal":false,"commodity_rarity":43,"commodity_category":1,"commodity_sub_category":15,"body_list":"Luminescent Planet","computed":{"can_mine":true}},"5":{"commodity_id":33,"body_id":8269,"stock_amount":8269,"commodity_remaining":2477441,"commodity_maximum":2479466,"commodity_name":"Arsenic","commodity_short_name":"As","commodity_illegal":false,"commodity_rarity":43,"commodity_category":1,"commodity_sub_category":15,"body_list":"Chemical Planet","computed":{"can_mine":true}},"6":
I am trying to break it down into the individual headers. Some of them won't be needed but if i can get them to cells i am fluent enough in excel formulas to extract the ones i'm looking for. So if it's not possible to write just the data i'm looking for from this that's annoying but i can live with it.