-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathMarkAsInvited.ts
More file actions
49 lines (47 loc) · 1.44 KB
/
Copy pathMarkAsInvited.ts
File metadata and controls
49 lines (47 loc) · 1.44 KB
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
function main(workbook: ExcelScript.Workbook, completedInvitesString: string) {
completedInvitesString = `[
{
"ID": "10",
"Candidate": "Adele ",
"CandidateEmail": "AdeleV@M365x904181.OnMicrosoft.com",
"CandidateContact": "1234567899",
"Interviewer": "Megan",
"InterviewerEmail": "MeganB@M365x904181.OnMicrosoft.com",
"StartTime": "2020-11-03T18:30:00Z",
"FinishTime": "2020-11-03T22:45:00Z"
},
{
"ID": "30",
"Candidate": "Allan ",
"CandidateEmail": "AllanD@M365x904181.OnMicrosoft.com",
"CandidateContact": "1234567978",
"Interviewer": "Raul",
"InterviewerEmail": "RaulR@M365x904181.OnMicrosoft.com",
"StartTime": "2020-11-03T23:00:00Z",
"FinishTime": "2020-11-03T23:45:00Z"
}
]`;
let completedInvites = JSON.parse(completedInvitesString) as InterviewInvite[];
const sheet = workbook.getWorksheet('Interviews');
const range = sheet.getTables()[0].getRange();
const dataRows = range.getValues();
for (let i=0; i < dataRows.length; i++) {
for (let invite of completedInvites) {
if (String(dataRows[i][0]) === invite.ID) {
range.getCell(i,1).setValue(true);
}
}
}
return;
}
// Invite record
interface InterviewInvite {
ID: string
Candidate: string
CandidateEmail: string
CandidateContact: string
Interviewer: string
InterviewerEmail: string
StartTime: string
FinishTime: string
}