Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ss = SpreadsheetApp.getActiveSpreadsheet();
- function resetList() {
- var todoSheet = ss.getSheetByName("todo list");
- var today = new Date();
- var todoList = [
- new Array(new Array(0, 1, 2, 3, 4, 5, 6),
- new Array("Check AH stuff", "SOLDIERDREAM")),
- // TEMPLATE
- // new Array(new Array(0, 1, 2, 3, 4, 5, 6),
- // new Array("Check AH stuff", "SOLDIERDREAM")),
- // Copy the above for each new item you want to add to the to do list.
- // Each number corresponds to a day of the week you want the item to appear.
- // The first item on the second line, "Check AH Stuff", in the example, will be added to the left column.
- // Any following items in that array will be written on the right column next to that task.
- // Remember to follow the structure strictly and put commas and quotation marks where appropriate.
- ];
- todoSheet.getRange('A1:B'+todoSheet.getMaxRows()).setValue("");
- var row = 1;
- for (var i=0; i<todoList.length; i++){
- var doToday = false;
- for (var j=0; j<todoList[i][0].length; j++){
- if (todoList[i][0][j]==today.getDay()){
- doToday = true;
- }
- }
- if (doToday){
- todoSheet.getRange('A'+row).setValue(todoList[i][1][0]); //Event
- for (var k=1; k<todoList[i][1].length; k++){
- todoSheet.getRange('B'+row).setValue(todoList[i][1][k]);
- row++;
- }
- }
- }
- }
- function countHells() {
- var hellSheet = ss.getSheetByName("hell log");
- var row = 5;
- var column = 'A';
- var hellCount = 0;
- var epicCount = 0;
- var orbCount = 0;
- var hellTotal = 0;
- var epicTotal = 0;
- var orbTotal = 0;
- while (hellSheet.getRange(column + '1').getValue()!=''){
- while (hellSheet.getRange(column+row).getValue()!=''){
- if (hellSheet.getRange(column+row).getValue()=='.'){
- row++;
- hellCount++;
- continue;
- }
- if (hellSheet.getRange(column+row).getValue()=='orb'){
- row++;
- hellCount++;
- orbCount++;
- continue;
- }
- row++;
- hellCount++;
- epicCount++;
- }
- hellSheet.getRange(column + '2').setValue(hellCount + " hells");
- hellSheet.getRange(column + '3').setValue(epicCount + " epics");
- hellSheet.getRange(column + '4').setValue(orbCount + " orbs");
- row = 5;
- column = nextChar(column);
- hellTotal = hellTotal + hellCount;
- epicTotal = epicTotal + epicCount;
- orbTotal = orbTotal + orbCount;
- hellCount = 0;
- epicCount = 0;
- orbCount = 0;
- }
- hellSheet.getRange(column+'2').setValue("Total");
- column = nextChar(column);
- hellSheet.getRange(column+'2').setValue("Runs: " + hellTotal);
- hellSheet.getRange(column+'3').setValue("Epics: " + epicTotal);
- hellSheet.getRange(column+'4').setValue("Orbs: " + orbTotal);
- column = nextChar(column);
- hellSheet.getRange(column+'3').setValue(epicTotal / hellTotal * 100 + '%');
- hellSheet.getRange(column+'4').setValue(orbTotal / hellTotal * 100 + '%');
- }
- function nextChar(c) {
- return String.fromCharCode(c.charCodeAt(0) + 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement