I'm creating a google sheet app script that will log the timestamp to another row (Column 40) upon editing of other cell value (column 3). This is what I have so far
It works, however, whenever I paste values to column 3 with a range of more than 1 cell, the script is just updating the 1st row. Result is something like this.
Appreciate any help.
Thanks in advance.
use offset instead of getRange
e.range.offset(0,38-col).setValue(currentDate)
Have you tried the alert dialog?
SpreadsheetApp.getUi().alert('row = ' + row + '\ncol = '+ col)
You can use it to debug your code. As you posted an image, I used it show where to insert this line and see what exactly are the values of your variables 'row' and 'col'.
Documentation: https://developers.google.com/apps-script/reference/base/ui#alert(String)
Hope it helps.