-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLogSheetOpenings.js
More file actions
32 lines (26 loc) · 825 Bytes
/
LogSheetOpenings.js
File metadata and controls
32 lines (26 loc) · 825 Bytes
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
/*
Created by: RemcoE33
https://github.com/RemcoE33/apps-script-codebase
1. Run setup once.
2. Cange your email so this will be excluded from the count.
3. Read count with function: 'getCurrentNumber'
*/
//Change your email below.
const email = "youremail@gmail.com";
function setup(){
const counter = PropertiesService.getDocumentProperties();
counter.setProperty("count", 0);
}
function onOpen(){
const counter = PropertiesService.getDocumentProperties();
const current = counter.getProperty("count");
const number = Number(current)+1;
if (Session.getActiveUser().getEmail() != email){
counter.setProperty("count", number);
}
}
//Read the current count
function getCurrentNumber(){
const counter = PropertiesService.getDocumentProperties();
console.log(counter.getProperty("count"));
}