ImportJSON to Google Sheets

/**
* Query's Fuzz market API for the given types
* @param {range} A vertical range of type_ids.
* @return maxBuy and minSell for each type_id
* @customfunction
*/
function fuzzApiPriceData(type_ids) {
  if (!type_ids) throw 'type_ids is required';
  var type_ids = Array.isArray(type_ids) ? type_ids.map(function(id) { return id[0]; }) : [type_ids];
  var fuzz_price_data = JSON.parse(UrlFetchApp.fetch("https://market.fuzzwork.co.uk/aggregates/?station=60003760&types=" + type_ids.join(',')));
  return [['minSell', 'maxBuy']].concat(type_ids.map(function(type_id) { return [parseFloat(fuzz_price_data[type_id]['sell']['min']), parseFloat(fuzz_price_data[type_id]['buy']['max'])]; }));
}

Can copy/paste this into your sheets script editor, Tools => Script Editor.

Then you can use it by passing it a vertical range of IDs to get prices for. By default the function is getting min sell and max buy in Jita.

=fuzzApiPriceData(A1:A500)

Suggested way to use this would be have a sheet for static data, like type_id and type_name, then use this function to get price data for those items. This would allow you to then easily use vlookup to get the prices/name of a type_id.

1 Like