I adapted a Google Apps Script from @Diego's Stack Overflow answer. The script moves the contents of a range to a new location.

The only modifications I made to the script was to remove the line source.clear() in order to have the script perform a copy instead of a cut, and I changed the sheet references to match my own.

The problem is that when the source range includes multiple rows, only the first row is copied to the destination.

How can I get the script to include all the rows?

function moveValuesOnly() {
   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var source = ss.getRange("RUNSHEET!H4:AC20");
   var destSheet = ss.getSheetByName("RUNSHEET");

2 Answers 2


You have to remove


by something else because

appendRow only adds one row of values



returns only the values of first row of source

That something else could be one of the methods getRange and then setValues(source.getValues()) or you could use copyTo

There are a lot of examples on this site.



Replacing @Diego's scrip with the script from the original question, "Copying and Paste Values into next empty Row in Google Sheets", resolved the problem.

The only modifications I made to the script from the question were:

  1. I updated the references to match my own.
  2. To preserve the original content (copy instead of cut), I removed the following line:
source.copyTo (destRange, {contentsOnly: true});

Updated Script

function moveValuesOnly () {
    var ss = SpreadsheetApp.getActiveSpreadsheet ();
    var source = ss.getRange ("Runsheet!H4:AB24");
    var destSheet = ss.getSheetByName("RunsheetData");
    var destRange = destSheet.getRange(destSheet.getLastRow()+1,1);
    source.copyTo (destRange, {contentsOnly: true});
  • I guess one person's problem is another person's solution (and vice versa) 🙂
    – Blindspots
    Jun 17, 2023 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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