Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const criteriaSheet = 'Data'
- const env = PropertiesService.getScriptProperties()
- const timestamp = env.getProperty('timestamp')
- const d2Value = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(criteriaSheet).getRange('D2').getValue()
- function onEdit(e){
- if(e.value = true && e.source.getActiveSheet().getName() == criteriaSheet && e.source.getActiveSheet().getActiveCell().getColumn() == 1 && d2Value == false) {
- const timestampValue = new Date().getTime()
- env.setProperty('timestamp',timestampValue)
- }
- }
- function check24(){
- const now = new Date().getTime()
- const difference = now - timestamp;
- if(difference >= 86400000){
- SpreadsheetApp.getActiveSpreadsheet().getSheetByName(criteriaSheet).getRange("D2").uncheck()
- }
- }
- function checkEnvManually(){
- console.log(timestamp)
- const date = (timestamp) ? new Date(Number(timestamp)) : 'No timestamp is set'
- console.log(date)
- }
Add Comment
Please, Sign In to add comment