DocsList.createFile sometimes creates blank or corrupted PDF
问题 I'm trying to create a google document (I would love to create it as HTML if this could work that way) then export that document as a pdf to send as an email attachment. Here is the basic structure that I have var docName = "test"; var doc = DocumentApp.create(docName); doc.appendParagraph("Hello World"); DocsList.createFile(docName, doc.getAs('application/pdf').getBytes(), 'application/pdf'); But this behaves oddly. Sometimes it creates a blank pdf, sometimes a corrupted one that doesn't