Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Creates a Date Stamp if a column is edited.
- */
- //CORE VARIABLES
- // The column you want to check if something is entered.
- var COLUMNTOCHECK = 2;
- // Where you want the date time stamp offset from the input location. [row, column]
- var DATETIMELOCATION = [0,-1];
- // Sheet you are working on
- var SHEETNAME = 'Sheet1'
- function onEdit(e) {
- var ss = SpreadsheetApp.getActiveSpreadsheet();
- var sheet = ss.getActiveSheet();
- //checks that we're on the correct sheet.
- if( sheet.getSheetName() == SHEETNAME ) {
- var selectedCell = ss.getActiveCell();
- //checks the column to ensure it is on the one we want to cause the date to appear.
- if( selectedCell.getColumn() == COLUMNTOCHECK) {
- var dateTimeCell = selectedCell.offset(DATETIMELOCATION[0],DATETIMELOCATION[1]);
- dateTimeCell.setValue(new Date());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement