Move Rows Into Section Headers in Google Sheets with Apps Script onEdit Get Code: https://docs.google.com/spreadsheets/d/1-Q1EMmkq4Z3C8CiV2D3XEMjwGXq-PY9HS39VSxkiFkI/copy The video shows how to automatically move a row within a single Google Sheet into a specific “section” defined by header labels in column B (e.g., aquatic, volcanic, zero G, forest) when the habitat value in column A is edited. It builds an Apps Script onEdit(e) function that reads the active sheet, edited range, row, column, and new value from the edit event, then restricts execution to a specific sheet name, rows below the header, and edits only in column A. The script pulls all values from column B, loops to find the matching section label, sets the target row to the row under that label, and uses moveRows to move the edited row to the correct section immediately. 00:00 Problem Setup 00:25 Why Sections Are Hard 00:57 Goal Move Row to Section 01:38 Open Apps Script 01:41 On Edit Trigger Basics 02:14 Capture Event Data 02:48 Guardrails Sheet Row Column 03:25 Read Section Labels 03:53 Find Target Row Loop 04:51 Move Row Into Section 05:17 Test and Fix Sheet Name 05:39 Wrap Up and Subscribe