I'm trying to write my first Google apps script to set up a Google sheet alert. I copied most of the code from another source and as such I am not familiar with the language/syntax of Google app script. I am attempting to have an alert trigger when any value in the M column is "No". Right now I can only get it to work by specifying a cell in M, such as M2, and it is returning the Alert whether that cell has "Yes" or "No" in it. If I change the "= "No"" in the script to something like "< 1500", the code seems to work. Please advise.
var HaveVehiclesBeenPhotographed = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2").getRange("M2");
var PhotoYesNo = HaveVehiclesBeenPhotographed.getValue();
var ui = SpreadsheetApp.getUi();
if (PhotoYesNo = "No"){
ui.alert('All Vehicles Have Not Been Shot!');