I have been trying to write this code to validate a range of cells. If the cells contain the text "true" then set value as "Incorrect Data" else "DD Data"
/** @OnlyCurrentDoc */function myFunction() { var app = SpreadsheetApp var activeSheet = app.getActiveSpreadsheet().getActiveSheet(); for (var i = 1; i<10; i++) { var workingcell = activeSheet.getRange(i,1).getValue(); if( workingcell == "TRUE" ) { activeSheet.getRange(i,2).setValue("Incorrect Data"); } else {activeSheet.getRange(i,2).setValue("DD Data");} }}
The code is executing without compilation error but it is not able to recognize the cell values because it is mark "DD Data" for all the cells which is incorrect. If the cell value is "TRUE" then -- "Incorrect Data" else "DD Data