copy and paste with google spreadsheet script

后端 未结 1 658
不思量自难忘°
不思量自难忘° 2021-01-01 05:15

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 sp

相关标签:
1条回答
  • 2021-01-01 06:00

    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 ();
    }
    
    0 讨论(0)
提交回复
热议问题