Reputation: 3
I'm currently writing a google app script to scan a column of cells.
I'd like to get the cells which their string has nth after "=".
i.e. Cell A1: "abc=" A2: "abc" A3: "abc=we=" A4: "abc=def=ghi="
i wanna get cell A1, A3, A4.
How to do that? Thanks
Upvotes: 0
Views: 48
Reputation: 64092
Try something like this:
function findEndsInEqual() {
var ss=SpreadsheetApp.getActive();
var sh=ss.getActiveSheet();
var rg=sh.getRange(1,1,sh.getLastRow(),1);
var vA=rg.getValues();
var foundA=[];
vA.forEach(function(e,i){
if(e.toString().trim().slice(-1)== "=") {
foundA.push("A" + Number(i+1));
}
});
Logger.log(foundA);
}
Upvotes: 1