Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a script that sorts a Google Spreadsheet when a value in a column is changed.

I'd like to add to the script the following functionality:

If the value for column E = "Complete" then the entire row is moved to a different spreadsheet (that is a different tab in the same Google Spreadsheet document).

The row would either be inserted, or appended to the bottom of the spreadsheet in the first blank row.

Is this possible?

share|improve this question
Can you share a doc with us? – Jacob Jan Tuinstra Jun 9 '13 at 19:50

Yes, I currently do this for a form system once it receives all necessary approvals I move all of the form submission's values to a new sheet that only contains approved submissions.

The following code gets the values of the row you would like to move and copies it (maintaining the original row) to the destination sheet. Assume that the submissionrow variable is the index of the row you want to move and the sheet variable is the source sheet you are checking the values on.

var lastcol = sheet.getLastColumn();
var rowvalues = sheet.getRange(submissionrow,1,1,lastcol).getValues();
var destinationsheet = SpreadsheetApp.openById(spreadsheetId).getSheetByName(nameofthedestinationsheet);
var rownum = destinationsheet.getLastRow() + 1;
destinationsheet.getRange(rownum, 1,1,lastcol).setValues(rowvalues);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.