The current script that you have will work (putting timestamp in column I
) after a few minor edits AND removal of the Slicer
- go into the Apps Script and correct the sheet name from:
if (r.getColumn() < 9 && ss.getName()=='Sheet1') { // 2. If Edit is done in any column before Column (I) And sheet name is Sheet1 then:
to:
if (r.getColumn() < 9 && ss.getName()=='Sheet 1') { // 2. If Edit is done in any column before Column (I) And sheet name is Sheet1 then:
while in the Apps Script editor, change the App Script's timezone by using the Legacy editor
and clicking File > Project properties > Time Zone
from the menu above the script editor.
Save the Apps Script, and return to the spreadsheet.
Change G-Sheets timezone (to match the timezone you selected in the Apps Script) by clicking File > Spreadsheet settings
Remove the Slicer
Test the script is working
I have tried several scripts that normally work (without Slicer), but the Slicer interferes with all of them so i can not offer you a script that works with the current Spreadsheet design while it uses the Slicer.
For a script that puts timestamp in column E when any edits are made in any other column, you can try this:
const sh = SpreadsheetApp.getActiveSheet();
const SHEETNAME = 'Sheet 1'; // SHEET to MONITOR
const COLTSL = 'E'; // COLUMN LETTER to TIMESTAMP
function onEdit(e) {
let r = sh.getActiveCell();
// If Edit is done in any column other than the timestamp column, And sheet name is Sheet 1 then:
if (r.getColumn() !== COLTSL && sh.getName() == SHEETNAME) {
let celladdress = COLTSL + r.getRowIndex()
sh.getRange(celladdress).setValue(new Date()).setNumberFormat("dd/MM/yyyy hh:mm");
}
}
However, this still has limitation that setValue will not function correctly (some rows work, others do not) while you have the Slicer enabled.