forked from klausrheum/supermarkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.gs
85 lines (72 loc) · 2.57 KB
/
archive.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
function ensureYearSheet(ss, year) {
var hasSheet = false;
var sheets = ss.getSheets();
for (var i in sheets ) {
if (sheets[i].getName() == year) {
hasSheet = true;
Logger.log('Sheet exists ' + sheets[i].getName() );
break;
}
}
if (! hasSheet) {
Logger.log("Creating sheet " + year);
var sheet = ss.insertSheet(year, sheets.length);
var titles = [["Last name", "First name", "Email", "Full Name", "Report Filename", "Report File Id"]];
sheet.getRange("A1:F1").setValues(titles).setFontWeight("bold");
}
return ss.getSheetByName(year);
}
function grabStuff() {
console.info('Starting the %s function (%d arguments)', 'grabStuff', 1);
var rb = SpreadsheetApp.openById(rbTrackerId);
var sheet = rb.getSheetByName("Y07");
var titles = sheet.getRange("A1:F1").getValues();
console.info(titles);
var formula = sheet.getRange("D2").getFormula();
console.info(formula);
}
function measuringExecutionTime() {
// A simple INFO log message, using sprintf() formatting.
console.info('Timing the %s function (%d arguments)', 'myFunction', 1);
// Log a JSON object at a DEBUG level. The log is labeled
// with the message string in the log viewer, and the JSON content
// is displayed in the expanded log structure under "structPayload".
var parameters = {
isValid: true,
content: 'some string',
timestamp: new Date()
};
console.log({message: 'Function Input', initialData: parameters});
var label = 'myFunction() time'; // Labels the timing log entry.
console.time(label); // Starts the timer.
try {
myFunction(parameters); // Function to time.
} catch (e) {
// Logs an ERROR message.
console.error('myFunction() yielded an error: ' + e);
}
console.timeEnd(label); // Stops the timer, logs execution duration.
}
// unfinished - save for Milestone 2
function importStudents() {
var yearRBs = [
["Y06", "1XNiXHrW4xAj3SMdsAm4ls66bbYBEjqd3I5rE35vZbmU"],
["Y07", "1UV9BysLHpyz4_ycPaV9QO1LxumJYW02umDGQXU2RG-s"],
["Y08", "16QHaHxkb_pIRtyu9UIOPYnjZy5WXkx8i7xBv0ZH8Zmg"],
["Y09", "1j9G8YqSyqX1xGzzM38881HkfonDW09bSRvo8rdipcRE"],
["Y10", "1w5EaRpcQqyrwhx-vRXofyabchFTXlncFAt3bdrLKrjw"],
["Y11", ""],
["Y12", ""]
];
for (var y in yearRBs) {
year = yearRBs[y][0];
yearId = yearRBs[y][1];
var students = getStudents(year);
for (var s in students) {
Logger.log(students[s] + ", " + year);
createStudentRB(students[s], year);
}
}
// createStudentRB(sarah, "Y09");
// createStudentRB(lily, "Y07");
}