title: TypeError: Cannot find function getSheets in object - looking for what's wrong
body: <p>While running this code, there is error while executing this line: </p>
  
  <pre><code>var invoiceSheet = newSSFile.getSheets()[0];' 
  </code></pre>
  
  <p>"TypeError: Cannot find function getSheets in object Copy of Invoice Przykładowy. (line 69, file "Code")"</p>
  
  <p>With this code I want:</p>
  
  <ol>
  <li><p>Create a new spreadsheet and move it to proper folder [works] </p></li>
  <li><p>Get a value from another spreadsheet and paste it in this new one [error] </p></li>
  </ol>
  
  <p>Looked for answer for an hour without any result. Any idea what might cause this error? </p>
  
  <pre><code>function invoice() {
  
  //Create copy SS + name
  var ssTemp = SpreadsheetApp.openById("1Cr2W_4lNrHYRdXK-KDQ7UFJJ3Iagh-tGct8Ee5Y");
  var newSS = ssTemp.copy("Copy of " + ssTemp.getName());
  // Move to folder
  var DestinyFolder = DriveApp.getFolderById("0B-y1OC8ChG2XRjRRbEJ");
  var newSSFile = DriveApp.getFileById(newSS.getId()); 
  DestinyFolder.addFile(newSSFile);
  DriveApp.getRootFolder().removeFile(newSSFile); 
  
  
  // Modify details
  // Invoice No  
  var klienciSS = SpreadsheetApp.openById("18B151VlJaVtDdQ9CcLrL3iwRAtWw2ZzZydproj");
  var klienciSheet = klienciSS.getSheets()[0];
  var klienciRange= klienciSheet.getRange('AB6');
  var klienciValue = klienciRange.getValue(); 
  var invoiceSheet = newSSFile.getSheets()[0];
  var inboiceRange = invoiceSheet.getRange('F4'); 
  newCellInvoice.setValue(klienciValue); 
  </code></pre>