Advertisement
Unique144

Untitled

Nov 11th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var sheetPoints = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Recycle");
  2. var apikey = "ph4vd7QZGVMBz0gc";
  3.  
  4. //morphine
  5.  
  6. function updatePoints() {
  7.  
  8.  
  9.   var i=66;
  10.   if(i=66)
  11.   {
  12.   for (var i=66, i<=68, i++)
  13.   {
  14.   var json = apiRequest("market", "bazaar", "66", apikey);
  15.  
  16.   if (json.bazaar) {
  17.     var values = [];
  18.     for (var pid in json.bazaar) {
  19.       var index = values.length;
  20.       if (index >= 9) break;
  21.      
  22.       values[index] = [];
  23.       values[index][0] = json.bazaar[pid].cost;
  24.       values[index][1] = json.bazaar[pid].quantity;
  25.       Logger.log(json.bazaar[pid]);
  26.     }
  27.     sheetPoints.getRange("A2:B" + (values.length + 1)).setValues(values);
  28.     Logger.log(values);
  29.   }
  30. }
  31.   function apiRequest(type, selections, id, key) {
  32.   return JSON.parse(UrlFetchApp.fetch("https://api.torn.com/" + type + "/" + id + "?selections=" + selections + "&key=" + key));
  33.   }
  34.   }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement