Skip to content

Instantly share code, notes, and snippets.



Last active May 1, 2017
What would you like to do?
Google Apps Script to update PM to-do spreadsheet when task is marked "Done."


  1. Open the spreadsheet in question.
  2. Go to Tools -> Script editor.
  3. Paste this code into the window, and save with File -> Save.
  4. Return to your spreadsheet and toggle a task to "Done." It shoulddddd work!

(Mostly stolen from here.)

function onEdit(e) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = e.source.getActiveSheet();
var cell = e.source.getActiveRange();
if( sheet.getName() == 'Tasks' && cell.getColumn() == 4 && cell.getValue() == 'Done'){
var row = cell.getRow();
var targetSheet = spreadsheet.getSheetByName("Tasks - done");
var targetRow = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
// 15 is a bit of a magic number but I doubt you'll ever pull more rows than that?
sheet.getRange(row, 1, 1, 15).moveTo(targetRow);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment