Reputation: 7
I have a Google sheet where form submissions are stored and I'm trying to run a Google App Script with an onUpdate trigger, to remove a generic chunk of text. I've run the script and got the "execution completed" message, but nothing happens after the script is run. App Script
function onUpdate() {
function replaceEverywhere () {
var spreadsheet = SpreadsheetApp.openById("1Gm1B-IGifpPuRsVj5mFbIwx4T7g1VuTM0nlzDgHzzFo");
var = sheet SpreadsheetApp.SetActiveSheet(spreadsheets.getSheets()[0]);
var textFinder = sheet.createTextFinder("From: Leigh-on-Sea SS9, UK
Building No. Street & Postcode: ");
textFinder.replaceAllWith(" ");
}
}
There's a .json file for a trigger, but I don't know if they're linked?? .json trigger
Ideally, the end result would be to automatically remove the chunk of text from existing and new entries (in column J)... then I need new entries in column J to replace/update an existing Google calendar event location... is there an addon to update event location from sheet, on a trigger?
Upvotes: -1
Views: 97
Reputation: 64130
Try it like this:
function replaceEverywhere() {
var ss = SpreadsheetApp.openById("1Gm1B-IGifpPuRsVj5mFbIwx4T7g1VuTM0nlzDgHzzFo");
var sheet = ss.getSheets()[0];
var textFinder = sheet.createTextFinder("From: Leigh-on-Sea SS9, UK Building No.Street & Postcode: ");
textFinder.replaceAllWith(" ");
}
function onUpdate() {
replaceEverywhere()
}
Upvotes: 0