0
votes

Based my previous question regarding a document merge I have created template. The template is stored in a shared folder or a team drive that is not directly accessible to the user. Whenever a user initiates a document merge, I would like the resulting PDF to be stored in the team drive and a copy to be emailed to the user. This way administrators don't need to create a copy for themselves as it is already stored in the team drive.

As I don't have Cloud SQL, I cannot access the App Maker PDF example that was released last month. But maybe someone can explain to me how I can find a solution for my requirements without Cloud SQL?

1

1 Answers

2
votes

Here is a link to the sample mentioned in the question for people who have Cloud SQL configured: Email PDF Sample. Just in case here are key code lines from the sample assuming that you already know how to send email (this one should work without Cloud SQL) and build a Doc from a record(s):

var tmpDoc = createDocFromRecord(record);

var blob = tmpDoc.getAs(MimeType.PDF);
var pdfFile = DriveApp.createFile(blob);

pdfFile.setName(FILE_NAME);

// sendEmail_(to, subject, body)
sendEmail_(Session.getActiveUser().getEmail(), FILE_NAME, pdfFile.getUrl());