I want to compare two cells and depending on whether they are equal or not send out different e-mails. After having read several articles on this topic I unfortunately do not see why the the following comparison with === always gives out as a result that the cells are different, even if I compare the same cells:
function SendEmail() {
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
var ui = SpreadsheetApp.getUi(); // var file = SpreadsheetApp.getActiveSheet();
if (sheet.getRange(2,10) === sheet.getRange(2,10)) {
MailApp.sendEmail("ab@gmail.com", "test", "not equal!");
} else {
MailApp.sendEmail("ab@gmail.com", "test", "equal!");
}
}
It also does not work if I use !==.
Any hint is highly aprreciated - thanks!