I have a Google Apps Script that, onFormSubmit, copies a template spreadsheet and populates it with values from the form. It then takes the new spreadsheet, converts it to PDF and e-mails it (as a blob attachment) to the submitter.
The problem I am experiencing is, the data in the PDF attachment is somewhat stale (some stuff is correct, other stuff is not). If I open the new spreadsheet directly, everything is correct. I have tried inserting a Utilities.sleep() function into the script to give the spreadsheet more time to populate but to no avail.
I have searched extensively but have been unable to find any answers. Any suggestions are greatly appreciated!