I am trying to receive an email whenever some changes happen to my google doc. I know that there is a trigger on it for google sheets, but I don't know how to do something like that in docs. I saw in this post Google Docs Add On onEdit that it might be possible to get an update every 60s, but couldn't figure out how it would send email?
MailApp.sendEmail('somebody@something.com','new edit')
I tried adding this code instead of callyourfunction(), bur nothing happened.
Update: Sorry I'm a beginner in Java and GAS, this is how far I got with the code:
function addTimeStamp(e){
var row= e.range.getRow();
var col= e.range.getColumn();
if (col===1 && row >1 && e.source.getActiveSheet().getName()=== "Sheet1"){
var currentDate=new Date();
e.source.getActiveSheet().getRange(row,4).setValue(currentDate);
if( e.source.getActiveSheet().getRange(row,3).getValue()==""){
e.source.getActiveSheet().getRange(row,3).setValue(currentDate);
}
}
}
so it would update the date in the 4th-row cell if changes happen to row 1. But What I want is to check the mentioned google docs ID in the first row and inform me of any changes that happen to that document.