title: google script paste value only
body: <p>I need help when copy sheet to new Spreadsheet. I wanted to paste only values.</p>
  
  <p>I am creating .pdf from a copy of sheet but the CopyTo copy also formula from sheet.</p>
  
  <pre><code> function topdf() {
    var foldersave = DriveApp.getFolderById('ID');
     var originalSpreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Print_sheet_Damir"); 
    var radni_sheet_Damir = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Radni_sheet_Damir");
    var name = originalSpreadsheet.getRange("C4").getValue();
    var ID = radni_sheet_Damir.getRange("E2").getValue();
   var newSpreadsheet = SpreadsheetApp.create("ID_" + ID + "_" + name);
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var projectname = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Print_sheet_Damir");
    sheet.copyTo((newSpreadsheet), {contentsOnly: true});
  
  
   newSpreadsheet.getSheetByName('Sheet1').activate();
    newSpreadsheet.deleteActiveSheet();
  
  pdf = newSpreadsheet.getBlob();
    var file = foldersave.createFile(pdf);
  </code></pre>
  
  <p>But the following line doesn't work for me:</p>
  
  <pre><code>sheet.copyTo((newSpreadsheet), {contentsOnly: true});
  </code></pre>