title: Created PDF does not reflect changes made to the original document
body: <p>I have a Google Docs template which is automatically copied into a folder and replace specific values with values coming from spreadsheet cells.</p>
  
  <p>The template contains values such as <code>&lt;&lt;41&gt;&gt;</code> which are used to be "find-and-replaced" with values coming from a spreadsheet.</p>
  
  <p><a href="https://i.stack.imgur.com/WlKNx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WlKNx.png" alt="template table"></a></p>
  
  <p>The find-and-replace process is fine, and the results of the document looks like this image below</p>
  
  <p><a href="https://i.stack.imgur.com/epkRk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/epkRk.png" alt="enter image description here"></a></p>
  
  <p>Now, I want this document to be converted into PDF after it has been updated, so I made a function for the convertion and call it at the bottom after all the codes has been executed.</p>
  
  <p>Here's the function: </p>
  
  <pre><code>//convert to PDF
  function convertPDF(FileID,newName) {
    Utilities.sleep(120000);
    docblob = DocumentApp.openById(FileID).getAs('application/pdf');
    /* Add the PDF extension */
    docblob.setName(newName + ".pdf");
    var file = DriveApp.createFile(docblob);
  }
  </code></pre>
  
  <p>The convertion works fine, but the converted document isn't updated. Rather, it is like it was the one freshly copied from the template, before the values were changed. </p>
  
  <p>If you may notice, I have added a "sleep" timer before in the conversion function so as to delay the conversion and give time for the changes to be saved, I've tried 1 and 2 minutes sleep but still it doesn't work.</p>
  
  <p>What can I do to make sure the PDF is created from the updated template?</p>