Automate Printing of Completed Google Form

I need to write this up before I forget what I did!

This is quite complex and draws on several resources. Why do this? Because in my organisation many have not/cannot move to online systems, we do not have the resources (e.g. tablets/laptops), or what we need is not yet written/ready, so whilst we can easily input data with google forms, we still need a paper copy in order to act on the contents and record actions. In addition this gets the data into a digital format we can work with (on the google sheet), making it easier to work with and interrogate later, without having to input it from the paper form.

Workflow as follows:

  1. Create new google account
  2. Create form and responses sheet
  3. User completes form and submits
  4. On submission a script grabs the form data
  5. This data is then inserted to a temporary google doc
  6. The google doc is converted to pdf
  7. The pdf is emailed as an attachment
  8. In Gmail the received email is labelled and filtered
  9. A second script saves the attachment to Google Drive
  10. On a linux PC, Grive is setup to sync a folder with Google Drive
  11. Incron is setup to watch this folder for new files
  12. A script runs if new file found, and prints the document/pdf

I can’t take credit for most of the scripting to do this, as most sourced from around the interweb, so I will link to the specifics as opposed to writing up myself, and my thanks to those much cleverer than me for the solutions.

Key activities:

  1. Grabbing the Data from the Form, Convert to PDF and Email
  2. Saving out the PDF attachment from Gmail to Google Drive
  3. Setting Up Grive
  4. Automating Printing
  5. CLI Print Commands

Putting this all together took me a couple of hours, along with testing and tweaking, getting my linux box connected up to the windows print server at work was the most fun!

I am now using this workflow in a variety of settings to get things done!

[EDIT]

I have now come up with a more streamlined solution that misses out the emailing step and requirement to extract the attachment from the email. Simply apply the scripting referred to in the following post:

Save PDF to Google Drive

I edited it down a bit to remove the notifications. Once I have it all together I will post my scripts…

[EDIT]

Here is the basics of the the google apps script that grabs the form data and saves it to a pdf

 

Grive is then run on a folder to sync the google drive with the folder

The incron job will then print automatically any new files arriving in the selected folder

Leave a Reply

Your email address will not be published. Required fields are marked *