-
Notifications
You must be signed in to change notification settings - Fork 0
/
Essay.ts
61 lines (52 loc) · 2.09 KB
/
Essay.ts
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
function getdata() {
srcSheetName = "CompileEssay";
destinationSS_ID = "10DKYgUgUHtJOARXMo03bF7ndpmk-l4fuIpQu7E2TCDc";
files = DriveApp.getFolderById("1UlInDuSjW9JhM0-eLD0MmGVaGJkxCDkp").getFiles();
destinationSpreadsheet = SpreadsheetApp.openById(destinationSS_ID);
destSheet = destinationSpreadsheet.getSheetByName('RekapEssay');
listFile = [];
while(files.hasNext()) {
file = files.next();
if (file.getMimeType() !== "application/vnd.google-apps.spreadsheet" || file.getId() === "17ypZDeFj5uZpAE1QSdMi9VKgKbQwV6_0Wv8RgxEGEK8") {
continue;
}
listFile.push(file);
}
listFile = listFile.sort(function(file1, file2) {
if (file1.getName().toLowerCase() < file2.getName().toLowerCase())
return -1;
else if (file1.getName().toLowerCase() > file2.getName().toLowerCase())
return 1;
else
return 0;
}
)
index = 2;
no = [[0]];
nameBefore = "";
for (i = 0; i < listFile.length; i++) {
sourceSS = SpreadsheetApp.openById(listFile[i].getId());
sourceSheet = sourceSS.getSheetByName(srcSheetName);
sourceName = sourceSheet.getRange('D4:D4').getValues();
sourceAssesor = sourceSheet.getRange('D5:D5').getValues();
sourceAspectFromAssesor = sourceSheet.getRange('D12:J12').getValues();
if (sourceName[0][0] !== nameBefore) {
index++;
no[0][0]++;
nameBefore = sourceName[0][0];
noCol = destSheet.getRange('A' + index + ':A' + index);
nameCol = destSheet.getRange('B' + index + ':B' + index);
assesorCol = destSheet.getRange('G' + index + ':G' + index);
aspectFromAssesorCol = destSheet.getRange('I' + index + ':O' + index);
} else {
noCol = destSheet.getRange('A' + index + ':A' + index);
nameCol = destSheet.getRange('B' + index + ':B' + index);
assesorCol = destSheet.getRange('H' + index + ':H' + index);
aspectFromAssesorCol = destSheet.getRange('P' + index + ':V' + index);
}
noCol.setValues(no);
nameCol.setValues(sourceName);
assesorCol.setValues(sourceAssesor);
aspectFromAssesorCol.setValues(sourceAspectFromAssesor);
}
};