I have a script trying to identify if "HRZ" is found in Column F18:F, but it doesn't seem to work... It never identifies "HRZ" even if that is all thats in the column... Anyone able to help?
function exportNotifyHinges() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Hinge'); //source sheet
var testrange = sheet.getRange('F18:F'); //range to check
var testvalue = (testrange.getValues());
var ui = SpreadsheetApp.getUi();
var shouldExport = true;
for (i=0; i<testvalue.length;i++) {
if ( testvalue[i] != "HRZ") {
var response = ui.alert("Vertical conformance data identified in report. \n\n Do you want to cancel the export?",ui.ButtonSet.YES_NO);
Logger.log(response);
if (response == ui.Button.YES) {
SpreadsheetApp.getActive().toast("Export Cancelled...");
shouldExport = false;
}
break;
}
}
testvalue[i]
to the console? Do you see a string? Or maybe something else - such as an array of data[ ... ]
? – andrewJames===
and!==
in preference to==
and!=
- background. – andrewJames