After much searching, I have solved the first part of my problem: I found the below script which copies data from one range and adds it to another sheet.
However, the range that it is copying from is going to be automatically updating via a formula. So, my next challenge is - how do I get the script to run when the cell changes?
I believe there is a way to 'watch cells' for changes, but I'm really not very technical so I haven't been able to figure it out!
Potentially added complication - I believe 'on edit' scripts only run when the spreadsheet is open, is that right? If so, I'm also going to need to figure out how to get the script to run to check for new values on timed intervals.
Here's my current script:
function moveValuesOnly() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var source = ss.getRange("Sheet1!F1:H3");
var destSheet = ss.getSheetByName("Feuil2"); // Déterminer l'emplacement de la première ligne vide. var destRange = destSheet.getRange(destSheet.getLastRow()+1,1); source.copyTo (destRange, {contentsOnly: true}); source.clear ();
}
onEdit
runs even if the spreadsheet is closed, but it works only if the edit has been manual (through typing), rather than a formula update. If you want your script to run automatically whenever the range is being updated - you need a workaorund with=importrange
andonChange
- see here or here. – ziganotschka