Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9699

How to use google apps script to validate a cell?

$
0
0

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


Viewing all articles
Browse latest Browse all 9699

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>