Last active
September 14, 2020 08:16
-
-
Save franklinokech/513ae89d965ade96349a43e6a817948e to your computer and use it in GitHub Desktop.
Google App Script to set date when a column in a Gsheet is selected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get date of entry | |
function onEdit(e) { | |
var ss = SpreadsheetApp.getActiveSheet(); | |
var r = ss.getActiveCell(); | |
//1.Change 'Sheet1' to be matching your sheet name | |
if (r.getColumn() < 9 && ss.getName()=='Data_entry') { // 2. If Edit is done in any column before Column (I) And sheet name is Sheet1 then: | |
var celladdress ='I'+ r.getRowIndex() | |
ss.getRange(celladdress).setValue(new Date()).setNumberFormat("MM/dd/yyyy"); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get date of entry | |
function onEdit(e) { | |
var ss = SpreadsheetApp.getActiveSheet(); | |
var r = ss.getActiveCell(); | |
//1.Change 'Sheet1' to be matching your sheet name | |
if (r.getColumn() == 37 && ss.getName()=='Payment Requests') { // 2. If Edit is done in column AI And sheet name is Payment Requests then: | |
var celladdress ='AL'+ r.getRowIndex() | |
ss.getRange(celladdress).setValue(new Date()).setNumberFormat("MM/dd/yyyy"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment