# PDF Generation - Google Scripts help

**URL:** <https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145>\
**Category:** Ask for Help\
**Created:** [February 2, 2021, 10:52pm UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145 "2021-02-02T22:52:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)\
**Post date:** [February 2, 2021, 10:52pm UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/1 "2021-02-02T22:52:48Z")

</div>

Evening all.

Something came up in a thread the other week which prompted me to find this. Full disclosure - I am utterly useless with coding, so was wondering if anyone knew if it was possible to trigger the PDF Creator from a new row being added to the sheet using script?

If that is possible, I think that it should be able to create a PDF copy of the form people are filling in, which would be awesome. If not, back to the drawing board.

> **[PDF Creator - Email form submission in a PDF - Andrew Roberts](https://www.andrewroberts.net/2016/11/pdf-creator-email-results-form-submission-pdf/)**
>
> This script automatically emails the submission from a Google Form as a PDF. The PDF is created by populating a Google Doc template from the values in the Google responses spreadsheet. Further to user requests, I have created many variations …

---

<div class="post-metadata">

**Author:** ![Cisco\_Muratalla](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cisco_muratalla/32/12358_2.png) [@Cisco\_Muratalla](https://community.glideapps.com/u/Cisco_Muratalla)\
**Post date:** [February 2, 2021, 11:06pm UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/2 "2021-02-02T23:06:53Z")

</div>

I used the same resource page to use a script to create a PDF from a named range with a specific name from a cell in the spreadsheet at saved in a folder. I am likely more code-useless, was not sure I could get it to work, but it does.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 3, 2021, 12:32am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/3 "2021-02-03T00:32:04Z")

</div>

> [@Mishta\_P](#):
>
> if it was possible to trigger the PDF Creator from a new row being added to the sheet using script?

Would have to ask @Darren_Murphy for this. I have a brief look at the link and seems like the author used a “.onFormSubmit()” line, would it be possible for us to change it to something like “.onChange()” and set an on change trigger Darren?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 3, 2021, 2:08am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/4 "2021-02-03T02:08:37Z")

</div>

> [@ThinhDinh](#):
>
> Would have to ask @Darren_Murphy for this. I have a brief look at the link and seems like the author used a “.onFormSubmit()” line, would it be possible for us to change it to something like “.onChange()” and set an on change trigger Darren?

Yes, that should work.  
But, you’d need to add some extra conditional logic to direct it _when_ to create and send the PDF.  
If you just replace the onFormSubmit() trigger with an onChange() trigger, then it will start creating a PDF every time a change is made anywhere in the spreadsheet. Which I suspect isn’t the desired behaviour 🤣

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 3, 2021, 2:35am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/5 "2021-02-03T02:35:29Z")

</div>

🤣🤣🤣 Yesss I admit I forgot those conditions sometimes then a bunch of emails arrived when I test it.

---

<div class="post-metadata">

**Author:** ![Mns\_Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mns_glide/32/2514_2.png) [@Mns\_Glide](https://community.glideapps.com/u/Mns_Glide)\
**Post date:** [February 3, 2021, 4:21am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/6 "2021-02-03T04:21:11Z")

</div>

Currently is there a way to generate PDF from Glide Table? Is there any plans for that capability?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 3, 2021, 4:31am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/7 "2021-02-03T04:31:58Z")

</div>

From a Glide Table?  
You’d need to use an integration tool such as Zapier or Integromat.

---

<div class="post-metadata">

**Author:** ![Mns\_Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mns_glide/32/2514_2.png) [@Mns\_Glide](https://community.glideapps.com/u/Mns_Glide)\
**Post date:** [February 3, 2021, 4:38am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/8 "2021-02-03T04:38:36Z")

</div>

If we are using purely Glide Table, no more Google sheets, will Zapier/Integromat still work?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 3, 2021, 5:16am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/9 "2021-02-03T05:16:15Z")

</div>

That’s a good question.  
I think the answer is yes, but with limitations.  
For example, you could still use the Webhook Action to post to an Integromat webhook endpoint, but the options from there would be limited. Integromat cannot access the data in the Glide tables, so it could only work with whatever parameters you pass through the webhook.

---

<div class="post-metadata">

**Author:** ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)\
**Post date:** [February 3, 2021, 8:24am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/10 "2021-02-03T08:24:23Z")

</div>

> [@Cisco\_Muratalla](#):
>
> I am likely more code-useless

I would be very surprised if this were the case. My coding skills are limited to

10 print “hello”  
20 goto 10

That was on the BBC Micro in the late 80’s. In hindsight I should have continued developing that skill set, alas I got really good at Tetris instead.

> [@Darren\_Murphy](#):
>
> But, you’d need to add some extra conditional logic to direct it _when_ to create and send the PDF.

Could I simply dump that data into a different spreadsheet altogether and use the onChange?

As you can probably tell, I like to work around my limitations.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 3, 2021, 8:43am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/11 "2021-02-03T08:43:24Z")

</div>

> [@Mishta\_P](#):
>
> Could I simply dump that data into a different spreadsheet altogether and use the onChange?
> 
> As you can probably tell, I like to work around my limitations.

Can you explain your use case in a little more detail?  
When you say “dump that data”, I’m not really sure what you’re referring to.

The thing about an onChange() trigger is that it fires _every_ time a change is made to the sheet it’s associated with. The original script that you posted was written to work with an onFormSubmit() event, so by default it will process the data that was submitted via the Google Form. An onChange() event has no visibility of any form data, so you need to tell it where to look.

---

<div class="post-metadata">

**Author:** ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)\
**Post date:** [February 3, 2021, 9:54am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/12 "2021-02-03T09:54:24Z")

</div>

I have an app, one part is a form that populates a sheet.

The data in this sheet isn’t needed in the app except to read the date the row was submitted and cross reference against who filled the form out, but no changes are made to the data after submitting.

The data is used externally of the app to create PDF’s.

From what you are saying the onChange would trigger when data on any sheet anywhere in the spreadsheet was updated (which would happen regularly with the app firing data here and there). I was wondering if I could send the form data to another sheet with only that data, so at that point onChange can apply to the whole spreadsheet.

Of course, there is probably a way to have it so onChange only happens when a row is added. But that would have involved me coding 🤣

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 3, 2021, 10:33am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/13 "2021-02-03T10:33:36Z")

</div>

Okay, I understand.  
So before I start writing some code for you (which I don’t mind doing, if it comes to that), let me ask another question…

Why not just send a webhook to Integromat, and let it do all the heavy lifting for you?

---

<div class="post-metadata">

**Author:** ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)\
**Post date:** [February 3, 2021, 10:58am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/14 "2021-02-03T10:58:18Z")

</div>

> [@Darren\_Murphy](#):
>
> Why not just send a webhook to Integromat, and let it do all the heavy lifting for you?

I am trying to avoid using any 3rd party services (that may end up costing) if at all possible. This app is a favour for a friend who’s company has been hit really hard by the pandemic. He currently uses some bespoke software to run his climbing gym which costs a fair chunk each month, and I am trying to replicate that with a Pro sub to glide which will be rather a lot less for him.

It has melted my brain at times, but I think I am all but there. This part involved coding, and my brain just will not go that far (damn you Tetris).

You would be a bloody legend if you could help.

I am sure something like this would be a fantastic resource for a lot of apps, as there are loads of situations where people need uneditable (PDF) copies of filled out forms.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 3, 2021, 11:04am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/15 "2021-02-03T11:04:28Z")

</div>

> [@Mishta\_P](#):
>
> I am trying to avoid using any 3rd party services (that may end up costing) if at all possible. This app is a favour for a friend who’s company has been hit really hard by the pandemic. He currently uses some bespoke software to run his climbing gym which costs a fair chunk each month, and I am trying to replicate that with a Pro sub to glide which will be rather a lot less for him.

Integromat have a very generous free tier, I’d really encourage you to take a look before ruling it out.

> [@Mishta\_P](#):
>
> You would be a bloody legend if you could help.
> 
> I am sure something like this would be a fantastic resource for a lot of apps, as there are loads of situations where people need uneditable (PDF) copies of filled out forms.

If you can give me access to an (editable) copy of your sheet, I’ll take a look (PM me if you want).

---

<div class="post-metadata">

**Author:** ![ehdubya](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ehdubya/32/24087_2.png) [@ehdubya](https://community.glideapps.com/u/ehdubya)\
**Post date:** [February 3, 2021, 2:59pm UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/16 "2021-02-03T14:59:20Z")

</div>

_cough Document Studio cough_

[https://workspace.google.com/marketplace/app/document\_studio/429444628321](https://workspace.google.com/marketplace/app/document_studio/429444628321)

---

<div class="post-metadata">

**Author:** ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)\
**Post date:** [February 3, 2021, 3:25pm UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/17 "2021-02-03T15:25:39Z")

</div>

Looks like it would do most of what I need it to when combined with the merge every hour. My only concern is that if it stops working, it isn’t something that is under our control to fix.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [February 25, 2021, 9:44am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/18 "2021-02-25T09:44:01Z")

</div>

try this: click the link below, click “offer price / reserve”, add comment “just testing” , submit, wait 10-20 seconds…  
check your email and PDF attachment…  
and see magic happen 😉

> **[E-Store](https://e-store.glideapp.io/dl/ewAiAHQAIgA6ADEALAAiAHMAIgA6ACIAYwBsAGEAcwBzAC0ASQBuAHYAZQBuAHQAbwByAHkAIgAsACIAcgAiADoAIgBVAGsATABWAFoAWQBTADEAVABqAEcAZAAzAGMANABqAE8AegB0AHkAUwBBACIALAAiAG4AIgA6ACIAUwBFAFIAVgBJAEMARQBTACIAfQA=)**
>
> Food delivery & pickup + Online bidding App

---

<div class="post-metadata">

**Author:** ![Richard\_Chow](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/richard_chow/32/842_2.png) [@Richard\_Chow](https://community.glideapps.com/u/Richard_Chow)\
**Post date:** [February 25, 2021, 11:05am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/19 "2021-02-25T11:05:05Z")

</div>

Hi Uzo, can give some hints on how to do it?

---

<div class="post-metadata">

**Author:** ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)\
**Post date:** [February 25, 2021, 11:09am UTC](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145/20 "2021-02-25T11:09:22Z")

</div>

Curious to see how this works. I didn’t get an email though after I did the process above. I put “just testing” in the required name field then hit submit. It’s been about 30 minutes and I haven’t received an email yet.

[Next page](https://community.glideapps.com/t/pdf-generation-google-scripts-help/22145.md?page=2)
