'Google sheet script about moving row to another tab using dropdown
Here is a video of what I am trying to do.
[https://soapbox.wistia.com/videos/rVDNWFKiuW][1]
The YT video I am trying to copy is
Here is the script he is using.
Script:
function onEdit(e) {
const src = e.source.getActiveSheet();
const r = e.range;
if (r.columnStart != 3 || r.rowStart == 1 || e.value == src.getName()) return;
const dest = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(e.value);
src.getRange(r.rowStart,1,1,3).moveTo(dest.getRange(dest.getLastRow()+1,1,1,3));
src.deleteRow(r.rowStart);
}
Solution 1:[1]
It works like this just using a simple trigger.
NO Need to create an installable trigger. I put a dataValidation in Sheet0 column 3 from a list Sheet1,Sheet2 and it works just fine.
function onEdit(e) {
const sh = e.range.getSheet();
if (e.range.columnStart != 3 || e.range.rowStart == 1 || e.value == sh.getName()) return;
const dest = e.source.getSheetByName(e.value);
sh.getRange(e.range.rowStart,1,1,3).moveTo(dest.getRange(dest.getLastRow()+1,1,1,3));
sh.deleteRow(e.range.rowStart);
}
Demo:
Solution 2:[2]
You need to create a Trigger to allow the script to perform the changes once you make a change on the drop down menu.
Example:
In this image I used the same script shown in the video and I added it as a trigger for the script. Note that it was added as an OnEdit type of trigger:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Gabriel Carballo |



