Home > Back-end >  Deleting Data in a specific range at a specific time automatically
Deleting Data in a specific range at a specific time automatically

Time:07-12

so first time for me here. I want to set up a script that automatically do the same step 2 times a day.

So basically what it have to do is:

  1. Copy&Paste into another sheet where i already got the script for
  2. Clear the range what is copied to the other sheet (B5:J100)
  3. Do this 2 times a day to a specific time

Here is my script i have for copy and paste:

function copyPaste() {
var ss=SpreadsheetApp.getActive();
var srcsh=ss.getSheetByName('Yard');
var dessh=ss.getSheetByName('Historie Yard');
var srcrg=srcsh.getRange('B5:J100');
var data=srcrg.getValues();
var desrg=dessh.getRange(dessh.getLastRow()   1,1,96,9);
desrg.setValues(data);

}

Maybe someone can help me with Step 2 & 3?

Any help would be greatly appreciated, thank you!

CodePudding user response:

Use srcrg.clearContent() and create two time-driven triggers, each to run the function at a specific hour.

CodePudding user response:

first of all thanks! i´m not sure how to do this. This script more or less just a copy. Maybe you can help me to set up this macro? i have no programming background and its the first time for me using a script

  • Related