I would like to modify the script shown below, so that if re-run, it does not overwrite pre-existing data, but instead writes the rows under it.
(I use the google spreadsheet)
moveValuesOnly fonction () {
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var source = ss.getRange ("Sheet1 F1: H3 ');
source.copyTo (ss.getRange ("Feuil2 A1! '), {contentsOnly: true});
source.clear ();
}
Here's a shortcut to copy and paste values only in Google Sheets: To copy only the value, highlight it, press “Ctrl” + “Shift” + “C” on your keyboard at the same time. To paste the value, press “Ctrl” + “Shift” + “V” at the same time.
Under Run, select the name of function you want to trigger. Under Events, select either Time-driven or the Google App that the script is bound to (for example, From spreadsheet). Select and configure the type of trigger you want to create (for example, an Hour timer that runs Every hour or an On open trigger).
To copy a format, press Ctrl+Alt+C (Windows or Chrome OS) or Command+Option+C (Mac). To paste, press Ctrl+Alt+V (Windows or Chrome OS) or Command+Option+V (Mac).
This version will find the first empty row in the destination sheet, and copy the source data so it starts there.
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 ();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With