Reputation: 145
I am wanting to find every instance of this character (’) in a specific Google sheet named "SF" and remove it from the sheet.
What I have thus far is the ability to remove it from a specific range within that sheet (i.e. J:J) but would like that range to be (A:AT)
Please advise on where my function is wrong in processing for a range.
function CleanInputs() {
var sf = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("SF");
var range = sf.getRange("J:J");
//Finds and replace character encoding issues from Screamingfrog
range.setValues(range.getValues().map(function(row) {
return [row[0].replace(/’/, "")];
}));
}
Upvotes: 1
Views: 165
Reputation: 27348
Use TextFinder and replaceAllWith:
function myFunction() {
const sheetName = "SF";
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sh = ss.getSheetByName(sheetName);
sh.createTextFinder("’").replaceAllWith("");
}
Upvotes: 1