Q: Run Google Script every other week I have a google spreadsheet for payroll, with a script that needs to run every other week.  Right now, I'm running it manually.  I would like to use a time-driven trigger, but i can't figure out any combination that will do every other Thursday at 1am.  Anyone know a way this might be done?

A: you could prototype extend the date object to give you a week number and then choose to call only on even numbered weeks (or odd obviously)
Date.prototype.getWeekNumber = function() {
  var firstDay = new Date(this.getFullYear(),0,1);
  return Math.ceil((((this - firstDay) / 86400000) + firstDay.getDay()+1)/7);
}

and then in your weekly on a thursday trigger, wrap the whole lot in a conditional like
if (today.weekNumber() % 2 === 0) {
  // triggered function here
}

but I think i like Phil Bozak's on/off flag approach

A: function createBiWeeklyTrigger() {
  // Trigger every other Monday at 06:00.
  ScriptApp.newTrigger('function_name')
      .timeBased()
      .everyWeeks(2)
      .onWeekDay(ScriptApp.WeekDay.MONDAY)
      .atHour(6)
      .create();
}


A: You can use script properties to save properties about your script.
Set the following function to run every week
function runEveryWeek() {
  var runThisWeek = ScriptProperties.getProperty("runThisWeek");
  if (runThisWeek) {
    //do your task here
    ScriptProperties.setProperty("runThisWeek",false);
  } else {
    ScriptProperties.setProperty("runThisWeek",true);
  }
}

You'll have to initialize the "runThisWeek" property so that it is properly set. 

A: Try this:
// The init() function runs once to set up the initial trigger.

function init() {
   ScriptApp.newTrigger("ThursdayTrigger")
    .timeBased()
    .atDate(2013, 3, 21) // Setup the first trigger on a specific date
    .create();
}

function ThursdayTrigger() {

  // 1. write the function code here

  // 2. delete the existing ThursdayTrigger

  var triggers = ScriptApp.getScriptTriggers();
  for (var i = 0; i < triggers.length; i++) {
    if (triggers[i].getHandlerFunction() == "ThursdayTrigger") {
      ScriptApp.deleteTrigger(triggers[i]);
    }
  }

  // 3. setup another trigger in the same function that triggers after 14 days.

  ScriptApp.newTrigger("ThursdayTrigger")
    .timeBased()
    .after(1000*60*60*24*14) // Alternate Thursday
    .create(); 
}


A: The ScriptProperties Library is now Depreciated. The PropertiesService Documentation helped me figure out the solution below.
function runEveryWeek() {
  var scriptProps = PropertiesService.getScriptProperties();
  if(scriptProps.getProperty('runThisWeek') == "True"){
    //do your task here
    Logger.log("tast executes");
    scriptProps.setProperty("runThisWeek", 'False');
  } else {
    Logger.log("task does not execute");
    scriptProps.setProperty("runThisWeek", 'True');
  }
}

I initially tried to set the values to booleans, but that caused an issue because the method .getProperty() has return type string. I tried to make the difference between the booleans and booleans-represented-as-strings explicit by using uppercase first letters.
You can test it out by checking the log after running it.
