Create Certificate from google doc template file. Using google app script

Hi coders.

I want to share my google app script code. With this app script code, you can generate certificates, the bill received, proof card, and much more from your google document template.

If you are interested to add this feature to your app you can follow my steps.

  1. Open your Google drive and make a new folder.
  2. Generate a share link of your google drive folder.
  3. Make your google Doc template into the new drive folder.
  4. Create a Google app script file and paste the code.
function doPost (e) {

  var tags = e.parameter.tags.split(",");

  var values = e.parameter.values.split(",");

  var name =;

  var driveFolder = DriveApp.getFolderById(e.parameter.folder);

  var doc = DriveApp.getFileById(e.parameter.tem);

  return docs(tags, values, name, driveFolder, doc);


function docs(tags, values, name, driveFolder, doc) {


  var copy = doc.makeCopy(driveFolder).setName("tamp"+ name);

  var document = DocumentApp.openById(copy.getId());

  var body = document.getBody();


    body.replaceText(tag, values[tags.indexOf(tag)]);



  var pdf = copy.getAs(MimeType.PDF);

  var pdffile = driveFolder.createFile(pdf).setName(name);

  var download = ""+pdffile.getId();


  return ContentService.createTextOutput(download);

  1. Rename the app script file and deploy it as a webapp and make it anyone accessible.

  2. Copy and save the deploy link.

  3. Now you need to make a procedure.

  4. You got the PDF download link by this block. ( direct download link )

How it,s work?
Basically, it’s just replacing some text from your template and make a pdf file.

I’m not good at English, and I know I didn’t understand you very well. So if you have any problems you can send me a message. Forgive me if I make a mistake

Thank you


You can change the #discuss to #guide

Nice idea :+1:

1 Like

Very nice.


I have an idea that I would like to create in the future… He enters an email and sends it to him through the script. Also, many can wear only one. It is like a Google spreadsheet, in addition to the script, in addition to Google documents. It is a work that takes time. The program can create certificates. But not one but hundreds and also send it to their personal emails

1 Like

Thank you for sharing your Idea.

1 Like