Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9624

Removing Last Updated value when No data was selected from the column to check

$
0
0

I need help on my Google Sheet script. It is working fine on showing the timestamp of Last Updated at colB every time a new Call Status was set at ColA ; but when I deleted the status at colA, the timestamp remains at colB. It should also be clear once no data was selected at colA.

Here is my google sheet>> t.ly/z2P0

Here is my script>>

var timezone = "UTC+00:00";var timestamp_format = "hh:mm:ss dd/MM/yyyy"; // Timestamp Format.var updateColName = "Call Status";var timeStampColName = "Last Updated";var sheet = event.source.getSheetByName('StatusDate'); //Name of the sheet where you want to run this script.var actRng = event.source.getActiveRange();var editColumn = actRng.getColumn();var index = actRng.getRowIndex();var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues();var dateCol = headers[0].indexOf(timeStampColName);var updateCol = headers[0].indexOf(updateColName); updateCol = updateCol+1;if (dateCol > -1 && index > 1 && editColumn == updateCol) { // only timestamp if 'Last Updated' header exists, but not in the header row itself!var cell = sheet.getRange(index, dateCol + 1);var date = Utilities.formatDate(new Date(), timezone, timestamp_format);cell.setValue(date);

Thank you so much for the help.


Viewing all articles
Browse latest Browse all 9624

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>