Google Apps Script – Copy and Paste Cell Contents Once a Week

google docsgoogle-apps-script

As per the title, I want to "move" the contents of a cell one column to the right once a week, specifically Sunday at 11pm

Must I use a script for that?

Best Answer

This piece of script will move the first entry of a row range to the next column:

Code

function myShift() {
  var sh = SpreadsheetApp.getActiveSheet();
  var data = sh.getRange("1:1").getValues();
  var counter=0;
  for(var i=0, iLen=data[0].length; i<iLen; i++) {
    if(data[0][i] == "") {
      counter++;
    } else {
      data[0][counter+1] = data[0][i];
      data[0][counter] = "";
      break;
    }
  }
  sh.getRange("1:1").setValues(data);
}

Trigger

enter image description here

Example

I've created an example file for you: Copy and Paste Cell Contents Once a Week

Explained

Add the script under Script Editor from the Tools menu. Press the "bug" button to debug the code and to authenticate the script. Goto Resources (in the script editor) and set the trigger as shown.