Last active
August 3, 2017 22:22
-
-
Save bennet0496/b384b6897117e8f678bcf66d678fe75b to your computer and use it in GitHub Desktop.
Technic Platform Modpack Statistics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getData() { | |
var response = UrlFetchApp.fetch('http://api.technicpack.net/modpack/litwr-after-humans-unofficial-import-bgde?build=349'); | |
Logger.log(response.getContentText()); | |
var data = JSON.parse(response.getContentText()); | |
Logger.log(data.downloads); | |
var sheet = SpreadsheetApp.openById("1H1AhF4bYGtjhT1rKhPuokfdO6VUf2yrYZ1oGPK97yH4").getSheetByName("data"); | |
var last = sheet.getLastRow(); | |
var lastdl = sheet.getDataRange().getCell(last, 2).getValue() | |
var lastrun = sheet.getDataRange().getCell(last, 3).getValue() | |
sheet.appendRow([new Date(), data.downloads, data.runs, data.downloads - lastdl, data.runs - lastrun]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment