Script Examples
Runescape Virtual High Scores (Personal) (With Script) - importCSVhighscore
function importCSVhighscore() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Virtual High Scores"); var cell = ss.getRange("Virtual High Scores!B1"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=hiscore/index_lite.ws?player="; // new link //var rsurl = "http://hiscore.runescape.com/index_lite.ws?player="; // old link var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("A1:C60"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(4, 1, csvData.length, csvData[0].length).setValues(csvData); }Runescape demo of Track Me PLUS (With Script) - trackme
function trackme() { // II XP II Scripted var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Track me"); var cell = ss.getRange("Track me!B2"); var cellValue = cell.getValue(); var cell = ss.getRange("Track me!A4"); var type = cell.getValue(); // if(type == 0 ) {var rsurl = "http://hiscore.runescape.com/index_lite.ws?player="; } // old link if(type == 0 ) {var rsurl = "http://services.runescape.com/m=hiscore/index_lite.ws?player="; } // new link if(type == 1 ) {var rsurl = "http://services.runescape.com/m=hiscore_ironman/index_lite.ws?player=";} if(type == 2 ) {var rsurl = "http://services.runescape.com/m=hiscore_hardcore_ironman/index_lite.ws?player=";} var csvUrl = rsurl+cellValue; var ss = SpreadsheetApp.getActive().getSheetByName('Data') lastColumn = ss.getLastColumn() var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data"); sheet.getRange(2,lastColumn + 1, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[1]); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(1,lastColumn + 1).setValue(now); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[0]);}function fetchskillxp() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Track me"); var cell = ss.getRange("Track me!B4"); var skill = cell.getValue(); var row = 0; var skillxp = 0; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Track me"); var range = sheet.getRange("A6:F1557"); range.clearContent();
if (skill == "Overall") {row = 2; } if (skill == "Attack") {row = 3; } if (skill == "Defence") {row = 4; } if (skill == "Strength") {row = 5; } if (skill == "Constitution") {row = 6; } if (skill == "Ranged") {row = 7; } if (skill == "Prayer") {row = 8; } if (skill == "Magic") {row = 9; } if (skill == "Cooking") {row = 10; } if (skill == "Woodcutting") {row = 11; } if (skill == "Fletching") {row = 12; } if (skill == "Fishing") {row = 13; } if (skill == "Firemaking") {row = 14; } if (skill == "Crafting") {row = 15; } if (skill == "Smithing") {row = 16; } if (skill == "Mining") {row = 17; } if (skill == "Herblore") {row = 18; } if (skill == "Agility") {row = 19; } if (skill == "Thieving") {row = 20; } if (skill == "Slayer") {row = 21; } if (skill == "Farming") {row = 22; } if (skill == "Runecrafting") {row = 23; } if (skill == "Hunter") {row = 24; } if (skill == "Construction") {row = 25; } if (skill == "Summoning") {row = 26; } if (skill == "Dungeoneering") {row = 27; } if (skill == "Divination") {row = 28; } if (skill == "Invention") {row = 29; } var column = 3; var printrow = 6; var ss = SpreadsheetApp.getActive().getSheetByName('Data') lastColumn = ss.getLastColumn() for(column ; column < lastColumn + 3;) { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data"); var cell = ss.getRange(row,column); var skillxp = cell.getValue(); var cell = ss.getRange(row,column-1); var skilllevel = cell.getValue(); var cell = ss.getRange(row,column-2); var skillrank = cell.getValue(); var cell = ss.getRange(1,column-2); var skilldate = cell.getValue(); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Track me"); SpreadsheetApp.getActiveSheet().getRange("A"+printrow).setValue(skilldate); SpreadsheetApp.getActiveSheet().getRange("B"+printrow).setValue(skillrank); SpreadsheetApp.getActiveSheet().getRange("C"+printrow).setValue(skilllevel); SpreadsheetApp.getActiveSheet().getRange("D"+printrow).setValue(skillxp); if (row == 29) { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("vllist"); var cell = ss.getRange("J"+printrow); var invvl = cell.getValue(); } else { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("vllist"); var cell = ss.getRange("E"+printrow); var invvl = cell.getValue(); } if (row != 2){ var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Track me"); SpreadsheetApp.getActiveSheet().getRange("E"+printrow).setValue(invvl);} var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("gain"); var cell = ss.getRange("C"+printrow); var gainxp = cell.getValue(); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Track me"); SpreadsheetApp.getActiveSheet().getRange("F"+printrow).setValue(gainxp); column = column + 3 printrow++ } }
Runescape demo of Inactive (With Scripts) - importCSVinactive
function importCSVinactive() { // II XP II Scripting var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent();var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); }
function one() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("A3:D503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!A3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,4).setValue(now);}
function two() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("E3:H503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!E3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,8).setValue(now);}
function three() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("I3:L503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!I3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,12).setValue(now);}
function four() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("M3:P503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!M3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,16).setValue(now);}
function five() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("Q3:T503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!Q3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,20).setValue(now);}
function six() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("U3:X503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!U3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,24).setValue(now);}
function seven() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("Y3:AB503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!Y3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,28).setValue(now);}
function eight() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("AC3:AF503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!AC3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,32).setValue(now);}
function nine() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("AG3:AJ503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!AG3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,36).setValue(now);}
function ten() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("AK3:AN503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!AK3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,40).setValue(now);}
function eleven() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("AO3:AR503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!AO3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,44).setValue(now);}
function twelve() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("AS3:AV503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!AS3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,48).setValue(now);}
function thirteen() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("AW3:AZ503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!AW3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,52).setValue(now);}
function fourteen() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("How to use"); var cell = ss.getRange("How to use!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var range = sheet.getRange("BA3:BD503"); range.clearContent(); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange("Script!A2:D501").copyTo(sheet.getRange("Previous weeks!BA3"), {contentsOnly:true}); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Previous weeks"); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(2,56).setValue(now);}
Runescape demo of clan ranks by xp (With Script) - importCSV
function importCSV() { // II XP II Coded var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Settings Manual Inputs"); // Select active sheet. var cell = ss.getRange("Settings Manual Inputs!D3"); //Get the clan name from cell D3 var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; // set up the url address with clan name. var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); // Clear out old downloaded clan data var range = sheet.getRange("F1:I501"); range.clearContent();var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); // call data from url in csv format var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); // select rawdata sheet and get csv clan data pasted into cell F1 sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); // raw data tab is hidden, use veiw to unhide. }
Runescape demo of clan ranks by points PLUS (With Script) - importCSVpoints
function importCSVpoints() { // II XP II Coded var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Settings Manual Inputs"); // Select active sheet. var cell = ss.getRange("Settings Manual Inputs!D3"); //Get the clan name from cell D3 var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; // set up the url address with clan name. var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); // Clear out old downloaded clan data var range = sheet.getRange("F1:I501"); range.clearContent();var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); // call data from url in csv format var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); // select rawdata sheet and get csv clan data pasted into cell A1 sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); // raw data tab is hidden, use veiw to unhide. }
Runescape demo of clan data recorder and tracker (With Script) - ClanData
function ClanData() { // II XP II Coded var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Instructions"); var cell = ss.getRange("Instructions!D3"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); }function trackclan() { var ss = SpreadsheetApp.getActive().getSheetByName('Tracker Data') lastColumn = ss.getLastColumn() var ss = SpreadsheetApp.getActiveSpreadsheet(); var source = ss.getSheets()[4]; var destination = ss.getSheets()[3]; var range = source.getRange("A1:D501"); range.copyValuesToRange(destination,lastColumn + 1 ,lastColumn + 5, 2,504); // Sheet-col-colend-row-rowend var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("rawdata"); var cell = ss.getRange("rawdata!K1"); var clantotal = cell.getValue();
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Tracker Data"); var cell = ss.getRange("Tracker Data!E2"); var firstruncheck = cell.getValue(); if(firstruncheck != ""){ var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Tracker Data"); var cell = ss.getRange(1,lastColumn - 1); var previoustotal = cell.getValue(); var gain = clantotal - previoustotal; } else{ var gain = 0;} var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[3]); var now = Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy") SpreadsheetApp.getActiveSheet().getRange(1,lastColumn + 1).setValue(now); SpreadsheetApp.getActiveSheet().getRange(1,lastColumn + 3).setValue(clantotal); var ss = SpreadsheetApp.getActiveSpreadsheet(); SpreadsheetApp.setActiveSheet(ss.getSheets()[2]); lastRow = ss.getLastRow() SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,2).setValue(now); SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,3).setValue(clantotal); SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,4).setValue(gain);}
Runescape demo of Citadel Capping scanner and tracker (With Scripts) - importCSVchanges
function importCSVchanges() { // II XP II Scripting var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); var cell = ss.getRange("Citadel!A2"); var cellValue = cell.getValue(); var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; var csvUrl = rsurl+cellValue; var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); var range = sheet.getRange("F1:I501"); range.clearContent(); var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); var csvData = Utilities.parseCsv(csvContent); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Script"); sheet.getRange(1, 6, csvData.length, csvData[0].length).setValues(csvData); var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var range = sheet.getRange("J3:J503"); range.clearContent(); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); var now = new Date(); SpreadsheetApp.getActiveSheet().getRange(4,1).setValue(now); }function Runemetrics100() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(14,1).setValue('Scanning...'); var playername = "Start" var row = 3; for(row = 3; row < 104;) { Utilities.sleep(500); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(14,1).setValue("Scanning " +row); var cell = ss.getRange(row,2); var playername = cell.getValue(); var urlstart = "https://apps.runescape.com/runemetrics/profile/profile?user="; var urlend = "&activities=20" var url = urlstart+playername+urlend var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true}); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(row,10).setValue(response); row++ } var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(14,1).setValue('Finished scan'); }
function Runemetrics200() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(20,1).setValue('Scanning...'); var playername = "Start" var row = 104; for(row = 104; row < 204;) { Utilities.sleep(500); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(20,1).setValue("Scanning " +row); var cell = ss.getRange(row,2); var playername = cell.getValue(); var urlstart = "https://apps.runescape.com/runemetrics/profile/profile?user="; var urlend = "&activities=20" var url = urlstart+playername+urlend var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true}); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(row,10).setValue(response); row++ } var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(20,1).setValue('Finished scan'); }
function Runemetrics300() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(26,1).setValue('Scanning...'); var playername = "Start" var row = 204; for(row = 204; row < 304;) { Utilities.sleep(500); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(26,1).setValue("Scanning " +row); var cell = ss.getRange(row,2); var playername = cell.getValue(); var urlstart = "https://apps.runescape.com/runemetrics/profile/profile?user="; var urlend = "&activities=20" var url = urlstart+playername+urlend var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true}); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(row,10).setValue(response); row++ } var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(26,1).setValue('Finished scan'); }
function Runemetrics400() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(32,1).setValue('Scanning...'); var playername = "Start" var row = 304; for(row = 304; row < 404;) { Utilities.sleep(500); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(32,1).setValue("Scanning " +row); var cell = ss.getRange(row,2); var playername = cell.getValue(); var urlstart = "https://apps.runescape.com/runemetrics/profile/profile?user="; var urlend = "&activities=20" var url = urlstart+playername+urlend var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true}); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(row,10).setValue(response); row++ } var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(32,1).setValue('Finished scan'); }
function Runemetrics500() { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(38,1).setValue('Scanning...'); var playername = "Start" var row = 404; for(row = 404; row < 504;) { Utilities.sleep(500); var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(38,1).setValue("Scanning " +row); var cell = ss.getRange(row,2); var playername = cell.getValue(); var urlstart = "https://apps.runescape.com/runemetrics/profile/profile?user="; var urlend = "&activities=20" var url = urlstart+playername+urlend var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true}); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(row,10).setValue(response); row++ } var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Citadel"); SpreadsheetApp.getActiveSheet().getRange(38,1).setValue('Finished scan'); }
function trackcapped() { var ss = SpreadsheetApp.getActive().getSheetByName('capped') lastRow = ss.getLastRow() var ss = SpreadsheetApp.getActiveSpreadsheet(); var source = ss.getSheets()[2]; var destination = ss.getSheets()[1]; var range = source.getRange("B2:D"); range.copyValuesToRange(destination,1,3,lastRow + 1,500); // Sheet-col-colend-row-rowend}
function cleartrackcapped() { var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("capped"); var range = sheet.getRange("A2:C"); range.clearContent();}
Import CSV script II XP II Rev3 - importCSVFromWeb - (To download your latest clan data)
function importCSVFromWeb() { // script name and start script open bracket { // II XP II script ("//" = reference comments beyond this point) var clanname = "Serenity Isle"; // Set Clan name as a variable var rsurl = "http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName="; // Set up URL address as a variable var csvUrl = rsurl+clanname; // set URL + Clan name as a variable var csvContent = UrlFetchApp.fetch(csvUrl).getContentText(); // Go collect Clan Data in CSV format (comma seperated vector) var csvData = Utilities.parseCsv(csvContent); // store data into variable csvData var ss = SpreadsheetApp.getActiveSpreadsheet(); // clear out previous downloaded data var sheet = ss.getSheets()[0]; // to prevent old data being left behind creating incorrect data var range = sheet.getRange("A1:D501"); // select cells range A1:D501 range.clearContent(); // clear out selected range var ss = SpreadsheetApp.getActiveSpreadsheet(); // Make the first tab sheet the active sheet ("Clandownload") ss.setActiveSheet(ss.getSheets()[0]); // sheet tabs start at zero var sheet = SpreadsheetApp.getActiveSheet(); // select active sheet and paste CSV clan data into cell A1 sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData); // column 1 , row 1 } // end script