Skip to content
// generated · Sheets

Move a row to a “Done” sheet when column E says Done.

I keep a tracker and want finished rows to leave the active list and pile up on their own tab.

“When I mark a row Done in column E, move that row to a separate sheet called Done.”

Keep completed rows at the bottom of the same list

If you still need finished tasks on this tab, try a two-key sort on a copy. The archive script below moves rows to another tab when column E changes. This example keeps them together and uses column G for status.

  1. On the copy, use two empty helper columns. With the last original field in G, title H Done key and I Original order. In H2 enter =IF(G2="Done",1,0) and fill down. In I enter fixed numbers 1, 2, 3 and so on in the current order.
  2. Select the entire tracker, including every task field, both helpers and the headers. In Excel choose Data → Sort and My data has headers. In Sheets choose Data → Sort range → Advanced range sorting options and Data has header row.
  3. Sort by Done key smallest to largest, then add Original order smallest to largest. In Sheets, A to Z sorts the numbers in ascending order. Sort the whole range again after a status changes. To restore the original sequence, sort by Original order alone.

Check four task IDs. Start with T-17 (Done), T-03 (Ready), T-24 (Done) and T-11 (Waiting). Expect T-03, T-11, T-17, T-24. Reopen T-17 and sort again. The order becomes T-17, T-03, T-11, T-24. Check that each ID still has its owner and due date.

Excel sort instructionsGoogle Sheets sort instructions

Archive a cleared licence from the right tab

Row 2 on two licence tabs has the same ID, 0007. Mira’s individual licence is cleared. Maple Branch’s licence is still open. Move Mira’s record into the individual archive while keeping the branch record in place.

Download the four-tab practice register (.xlsx)Download the Apps Script (.gs)

  1. In a new Google Sheet, choose File → Import → Upload. Select the practice register and replace the new blank spreadsheet. The downloaded workbook remains your original.
  2. Open the downloaded .gs file in a text editor. In the spreadsheet choose Extensions → Apps Script, paste its contents into the bound project and save. Reload the spreadsheet to see Archive rehearsal.
  3. On Individual licences, choose Archive rehearsal → Archive a cleared ID on this tab and enter 0007, including the zeros. Approve access to this spreadsheet if prompted. Mira’s five cells move to Individual archive. The next record stays on its original row.
  4. Run the same command again on the same tab. You should see Already archived: 0007, with one archived copy. Check row 2 on Branch licences for Maple Branch, still open.

This practice register uses five text columns. The script checks the source tab, exact ID, cleared status and archive contents before clearing the source cells. A conflicting archive entry stops the move for review. Run it on a copy while other editors are away. To inspect or share the result, choose File → Download → Microsoft Excel (.xlsx).

The script

copy · paste · trigger
moveDoneRows.gs
Apps Script
// Made with bulldo.gs · describe an automation, get working Apps Script.
// Fork or fix this one → https://bulldo.gs/g/move-done-rows-to-archive-sheet

// Bound onEdit trigger. When column E of a row reads "Done", copy the
// whole row to a sheet named "Done", then delete it from the source sheet.
function onEdit(e) {
  const range = e.range;
  if (range.getColumn() !== 5) return;          // only column E
  if (range.getValue() !== 'Done') return;      // only the "Done" value

  const sheet = range.getSheet();
  if (range.getRow() === 1 || range.getNumRows() !== 1 || range.getNumColumns() !== 1) return;
  if (sheet.getName() === 'Done') return;
  const done = sheet.getParent().getSheetByName('Done');
  if (!done) return;
  const row = sheet.getRange(range.getRow(), 1, 1, sheet.getLastColumn()).getValues()[0];

  done.appendRow(row);
  sheet.deleteRow(range.getRow());
}
Fork this script

Made with bulldo.gs. Fork it to change a field, a trigger, or the edge cases — describe the change and Gnaw rewrites it.

Walkthrough

How it works

The example acts on a single data cell in column E containing the exact text "Done". It skips the header, multi-cell pastes and edits to the archive itself.

It reads the full row with getRange(row, 1, 1, getLastColumn()), appends it to the Done sheet, then deletes the source row. These are separate operations, not an atomic move: a failure between them can leave a duplicate. Concurrent edits can also move row positions; this minimal example needs coordination and recovery before unattended use.

A bound simple onEdit trigger can modify its own spreadsheet. Installable triggers are needed for services that require additional authorization; moving between tabs of this same spreadsheet does not by itself require one.

Set it up

Create a tab named exactly "Done". Open Extensions → Apps Script from your practice spreadsheet, paste the function and save. The bound onEdit function runs on a manual edit. Installing a second on-edit trigger would run the same handler twice.

Need a different version?

Describe your sheet or inbox and the rule you want. Gnaw writes the Apps Script — fields, triggers, edge cases — in one shot.

FAQ

3 questions
What if the "Done" sheet does not exist?
The handler leaves the source alone. Create the Done tab, then make a new status edit on a practice row.
Can I trigger on a checkbox instead of the word "Done"?
Yes. A checked box is the boolean true, so change the value check to `if (range.getValue() !== true) return;`.
Deleting the row shifts everything up — is that a problem?
Yes. Row numbers can shift during concurrent edits or a sort. Try the archive-by-ID exercise for a two-tab register. The short example skips edits spanning multiple cells.