dimanche 13 juin 2021

Google Script Syntax for CELL CONTAINS TEXT

I need to write several if statements with multiple conditions, of which some conditions are simply looking for cells that contain text. Below is an example of the script I am using. In this example I need value [2] to be the correct syntax for cell contains text. I tried several ways including <>"" which does not work. Is there a way to express cell contains text without adding additional lines to the code? Thank you for any help.

function onEdit2(e){

var ss = e.source;

var sheet = ss.getActiveSheet();

var row = e.range.getRow();

var col = e.range.getColumn();

  var validSheets = ["3","4","5","6"];

var value = [];

if(row > 1 && col <=7 && validSheets.includes(sheet.getName())){

value = sheet.getRange(row,2,2,5).getDisplayValues().flat();


  if(value[0] == "Outgoing" && value [1] == "FASTWAY" && value [2] === <>"" && value [3] == "TARGET"){

sheet.getRange(row,10).setValue("USE HEAT TREATED PALLET");

}}

Aucun commentaire:

Enregistrer un commentaire