'Transfer data by script on GoogleSheet

I already have a script that kind of making what I want, but I have a small issue with it, it's that it copy all the sheet with everything instead for me, I want it to be just the values of the cells and past them to the 2nd sheet. Here is my code

function copyValueFromSheetToSheet() {
   var ss = SpreadsheetApp.getActiveSpreadsheet();
  var copySheet = ss.getSheetByName("Sheet1");
  var pasteSheet = ss.getSheetByName("Sheet2");

  // get source range
  var source = copySheet.getRange(2,1,12,4);
  // get destination range
  var destination = pasteSheet.getRange(pasteSheet.getLastRow()+1,1,12,1);

  // copy values to destination range
  source.copyTo(destination);

  // clear source values
  source.clearContent();
  Browser.msgBox('Commande Confirmer');
}

thank you



Solution 1:[1]

Description

Modify your code as shown below

Script

// get source range
var source = copySheet.getRange(2,1,12,4).getValues();
var destination = pasteSheet.getRange(pasteSheet.getLastRow()+1,1,12,4).setValues(source);

// copy values to destination range
// source.copyTo(destination); <- not needed

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 TheWizEd