i would like to see if theres a way that i can timestamp in column A in front of the row edit or a particaular number of column is edited or updated. Google Sheet I have heard appscript can be used but dont know how
CodePudding user response:
I believe your goal is as follows.
- When a cell is edited, you want to put the timestamp to column "A" of the same row of the edited cell.
- You want to achieve this using Google Apps Script.
In this case, how about the following sample script? In this sample script, in order to detect the edit of cells, the simple trigger of OnEdit is used.
Sample script:
Please copy and paste the following script to the script editor of Spreadsheet. And, please set the sheet names you want to use, and save the script. When you use this script, please edit the cells. By this, the timestamp is put into column "A".
function onEdit(e) {
const sheetNames = ["Sheet1"]; // Please set your sheet name.
const { range } = e;
const sheet = range.getSheet();
if (!sheetNames.includes(sheet.getSheetName()) || range.columnStart == 1) return;
sheet.getRange(range.rowStart, 1, range.rowEnd - range.rowStart 1).setValue(new Date());
}
Note:
- In this sample script, if you want to use the script with multiple sheets you want, please modify
const sheetNames = ["Sheet1"];
likeconst sheetNames = ["Sheet1", "Sheet3",,,];
.