function fetchData() { var options = {'Cache-Control' : 'max-age=0, must-revalidate'}; //I've used this before to try and prevent google from giving me cached data when making API calls..seems to get the job done var sheet = SpreadsheetApp.getActiveSheet(); //This script is bound to the corresponding sheet so we can use this conveinience method var cell = sheet.getRange(sheet.getLastRow(),1); //Get a reference to current last cell in Column A var raw_data = UrlFetchApp.fetch("https://www.wanikani.com/api/user/API_GOES_HERE/srs-distribution", options).getContentText() var doc = JSON.parse(raw_data); //Total up kanji at guru and above var derp = doc.requested_information.guru.kanji derp += doc.requested_information.master.kanji derp += doc.requested_information.enlighten.kanji derp += doc.requested_information.burned.kanji //Total up vocab at guru and above var derp2 = doc.requested_information.guru.vocabulary derp2 += doc.requested_information.master.vocabulary derp2 += doc.requested_information.enlighten.vocabulary derp2 += doc.requested_information.burned.vocabulary //Write new data at (last_row + 1) cell.offset(1,0).setValue(new Date()); cell.offset(1,1).setValue(doc.requested_information.apprentice.total); cell.offset(1,2).setValue(doc.requested_information.guru.total); cell.offset(1,3).setValue(doc.requested_information.master.total); cell.offset(1,4).setValue(doc.requested_information.enlighten.total); cell.offset(1,5).setValue(doc.requested_information.burned.total); cell.offset(1,6).setValue(derp); cell.offset(1,7).setValue(derp2); }