dimanche 28 février 2021

Google App Script check if the edited cell contains space

The following code is not working when I put a value with space in editedCellValue

function onEdit(e) {

var editedCellRange = 
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Test").getActiveRange();
var editedCellValue = 
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("test").getActiveRange().getValue;
if (RegExp(editedCellValue).test("\s")==true){editedCellRange.setValue("contains space")}
else 
{editedCellRange.setValue("ELSE IF")}
}

Please help on why this is not working.

thanks.

Aucun commentaire:

Enregistrer un commentaire