I have a script in a spreadsheet that receives responses from a Form. Using these responses and a template Google document, I create a new Document from the template and then re
You need to use saveAndClose() to update the document before converting it.
In your code :
function savePDF(doc) {
doc.saveAndClose();
var docblob = doc.getAs('application/pdf');
var folder = DocsList.getFolderById(TARGET_FOLDER);
docblob.setName(doc.getName())
folder.createFile(docblob);
}
You don't need the sleep delay, you can remove it unless you want to wait for 15 seconds ;-)