title: copyTo(destination, copyPasteType, transposed) stops rest of function from executing
body: <p>I'm trying to use the function <code>copyTo(destination, copyPasteType, transposed)</code> to copy a sheet in one file to another sheet in a different file while keeping everything, including column width, the same. Using just the function <code>copyTo(destination)</code>, my code works and I get everything I want in a different file, EXCEPT the column width. However, when I try and use <code>copyTo</code> with the <code>copyPasteType</code> argument, the sheet is copied perfectly (with the correct column widths), BUT any subsequent code isn't run. Why is this happening, and how can I fix it?</p>
  
  <pre><code>function createSpreadsheet(foldername) {
    var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = spreadsheet.getSheetByName('Sheet1');
  
    var folder = DriveApp.getFolderById(foldername);
  
    RESPONSE = FileName(); //a function that prompts the user for a filename
  
    //creates a new spreadsheet which has two sheets, and deletes the "Copy of Sheet1" sheet
    var newSpreadsheet = SpreadsheetApp.create(RESPONSE);
    var newsheet = newSpreadsheet.getSheetByName('Sheet1');
    var copysheet = sheet.copyTo(newSpreadsheet);
    sheet.copyTo(newSpreadsheet, SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  
    //when using CopyPasteType argument, everything from here down isn't run
    copysheet.getDataRange().copyTo(newsheet.getDataRange());
    copysheet.getDataRange().copyTo(newsheet.getDataRange(), 
    SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
    newSpreadsheet.deleteSheet(copysheet);
  
    var newSpreadsheetID = newSpreadsheet.getId();
    var file = DriveApp.getFileById(newSpreadsheetID);
    folder.addFile(file); 
    DriveApp.removeFile(file);
    clearYellow(); //clears contents of yellow cells
    clearGray(); //clears contents of gray cells
  }
  </code></pre>
  
  <p>I've also <a href="https://plus.google.com/114160934823386208913/posts/S3NDyRgnRLY" rel="nofollow noreferrer">asked this question in Google+</a> </p>