Replace text in Google Spreadsheets with Apps Script

Photo by Alex Nicolopoulos on Unsplash
var activeSheet = sheet.getActiveSheet();
var textFinder = activeSheet.createTextFinder(‘Tom’);
var activeSheet = sheet.getActiveSheet();
var range = sheet.getActiveRange();
var textFinder = range.createTextFinder(‘Tom’);

All together now

function replaceEverywhere() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var textFinder = sheet.createTextFinder(‘Tom’);
textFinder.replaceAllWith(‘Scratchy’);
}

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store