0

I'm trying to copy the values from one sheet : https://docs.google.com/spreadsheets/d/1UDWk1xGnnL6qH_l5vo2MMwGH8wyXu0D9DCQMmZEKUJ0/edit#gid=0

To another : https://docs.google.com/spreadsheets/d/1dWYj2W3gTDnNuqgX9O9RS0WWL02aDUQAVl1HJ5jTtvE/edit#gid=595677628

I tried the code there, but when I run it, nothing happens. I'm new to programmation, so maybe it's something vary basic.

function myFunction() {
function transferList() {
  var sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("OVERVIEW");
  var sourceData = sourceSheet.getDataRange().getValues();
  var targetSS = SpreadsheetApp.openById("1dWYj2W3gTDnNuqgX9O9RS0WWL02aDUQAVl1HJ5jTtvE").getSheetByName("RAWDATA");
  var targetRangeTop = targetSS.getLastRow();
  targetSS.getRange(targetRangeTop+1,1,sourceData.length,sourceData[0].length).setValues(sourceData);
}
}

I would like the values to be copied at the last available row...

2
  • Why do you have a function defined within a function - this isn't required at all to achieve your goal. Commented Sep 9, 2019 at 15:32
  • wow... thanks, see I'm a real newb and it worked ! Commented Sep 9, 2019 at 15:34

1 Answer 1

0
function transferList() {
  var sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("OVERVIEW");
  var sourceData = sourceSheet.getDataRange().getValues();
  var targetSS = SpreadsheetApp.openById("1dWYj2W3gTDnNuqgX9O9RS0WWL02aDUQAVl1HJ5jTtvE").getSheetByName("RAWDATA");
  var targetRangeTop = targetSS.getLastRow();
  targetSS.getRange(targetRangeTop+1,1,sourceData.length,sourceData[0].length).setValues(sourceData);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.