Here’s a handful of posts that might help. As far as the trigger, be sure to look for this icon when writing the script. This allows you to set up a trigger. Just make sure it’s an onChange trigger.
function trailerDelete(e) { //This is the onChange(e) trigger
var app = SpreadsheetApp;
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var targetSheet = app.getActiveSpreadsheet().getSheetByName(“Report”);
// You can replace “Report” in the above line, to the sheet that you are referencing.
//Logger.log (targetSheet.getRange(2, 2).getValue() + " Test");
if (e.changeType==“EDIT”){
for (var i = 2; i < 6;i++){
if (targetSheet.getRange(i,2).getValue() ==""){
targetSheet.…
The only recommendation would be to look at a bunch of script writing tutorials and write one. Then 2, then 3, etc… Then keep writing them until you are confident that it does what you want. To simply clear a few columns is pretty straight forward. If you wanted to clear the contents of columns E and F on Sheet2, this is the script.
function clearAFewColumns() {
var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet2');
var lastRow = sheet.getLastRow();
// Column E = 5; F = 6 …
This is the script I use:
function clearRange() {
//replace 'Sheet1' with your actual sheet name
//replace 'Range' with the range you want to clear
var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1);
sheet.getRange('Range').clearContent();
}
[Screen Shot 2020-04-02 at 9.42.59 PM]
When you get into the script editor one of the icons is a picture of a clock. That is where you would set up the timed trigger. I lied, the code is actually 44 lines of code but I did throw in some comments to hopefully make it easier to follow. I did use arrays as that is the fastest way to scan through data and write to a sheet in mass. So basically you would set up a trigger to run this code, maybe nightly to clean up the orphan’d children. Here is the sheet. Make a copy of it and then t…
1 Like