Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sheetPoints = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Recycle");
- var apikey = "ph4vd7QZGVMBz0gc";
- //morphine
- function updatePoints() {
- var i=66;
- if(i=66)
- {
- for (var i=66, i<=68, i++)
- {
- var json = apiRequest("market", "bazaar", "66", apikey);
- if (json.bazaar) {
- var values = [];
- for (var pid in json.bazaar) {
- var index = values.length;
- if (index >= 9) break;
- values[index] = [];
- values[index][0] = json.bazaar[pid].cost;
- values[index][1] = json.bazaar[pid].quantity;
- Logger.log(json.bazaar[pid]);
- }
- sheetPoints.getRange("A2:B" + (values.length + 1)).setValues(values);
- Logger.log(values);
- }
- }
- function apiRequest(type, selections, id, key) {
- return JSON.parse(UrlFetchApp.fetch("https://api.torn.com/" + type + "/" + id + "?selections=" + selections + "&key=" + key));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement