Add Info to a PDF then Send as an Email Attachment using Zapier
In this tutorial, we will show you how to automatically add a client's information to a PDF and send it as an email attachment back to the client. The client information is collected through an online form and stored in a Google Sheet. The email will be sent from your address, regardless of whether your email domain is hosted on Microsoft 365, Google Mail, or another provider. Below is an image of the Google Sheet with the client information we'll be using.
![Client Information](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F78a4fae7b6d156301eca7ed191e6d1199d3525f0-780x300.png&w=1920&q=75)
Step 1: Google Sheets Module
Let’s start by adding the Google Sheets module to access the form response data.
![Google Sheets module](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F3ef2d5676691ed9b4405b1df60697f686cf0f60b-780x385.png&w=1920&q=75)
Step 2: Setup Google Sheets
- Provide the name of the spreadsheet you would like to access.
- Choose the specific worksheet where the data has been stored.
![Setup Google Sheets](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F89c2a49738f11fa29caf8c8e90fdaddaacdb6b3f-780x570.png&w=1920&q=75)
Step 3: Test Trigger
Next, test the trigger to fetch the row in the spreadsheet where the response data is located.
![Test Trigger](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Fc8ea38aae9384853bc440c18584f551a94ee158f-780x635.png&w=1920&q=75)
Step 4: PDF.co PDF Filler
Now, we will integrate the PDF.co app and PDF Filler feature to insert the data into the PDF template.
![PDF Filler in PDF.co](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Fbd02b1512bed3ed0ed5b1226cd37b0f14f920590-780x460.png&w=1920&q=75)
Step 5: Setup PDF Filler Configuration
- In the "Source PDF" field, enter the URL of the PDF template. Our template is stored in PDF.co File Storage, ensuring the file is kept private and is exclusively used for PDF.co processing via a filetoken:// link.
- For the "Text Annotation" fields, enter the x and y coordinates, as well as the page range where you wish to insert the text. Then, map the Google Sheets data. Please follow this format for guidance:
x;y;page;text
. To easily obtain the coordinates of the PDF document, you can utilize the PDF Inspector tool. Here is a sample demonstration illustrating how to utilize the PDF Inspector to obtain the x and y coordinates. You can access the demo by clicking on the following link: Demo
![PDF Filler Configuration](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Fd25f41f4c7692b6ca1c243664b1c4f507ea662ab-780x565.png&w=1920&q=75)
Step 6: Test PDF Filler
Now, proceed to test the PDF Filler feature to incorporate the Google Sheets data into the PDF template. After testing, copy the URL provided and paste it into your browser to view the result.
![Test PDF Filler](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F9ce5cffbbee046aae0fed3372941aeacca2a3ac3-780x880.png&w=1920&q=75)
Step 7: Filled PDF Template
Below is a sample PDF template as well as the PDF template that has been successfully populated with data from Google Sheets.
![Filled PDF Template](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F1995b4b16896e0364b14c78e879ead60e0d43676-780x235.png&w=1920&q=75)
Step 8: PDF.co Send Email with Attachment
Now, integrate the PDF.co app and choose the "Send Email with Attachment" feature to send the PDF template as an attachment to an email, regardless of whether the email domain is hosted on Microsoft 365, Google Mail, or another email service provider.
![PDF.co Send Email with Attachment](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Fbdece573c9e0c24cd6c189037152e9fe86893e81-780x435.png&w=1920&q=75)
Step 9: Setup PDF.co Configuration
- Include your email address as the sender.
- Select the recipient's email address from the Google Sheet.
- Specify the email subject for the recipient's reference.
- Enter the SMTP server address of your email domain host. For SMTP setup details, please refer to this page.
- Provide the SMTP server port of your email domain host.
![Setup PDF.co Configuration](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2Fa2b4800eca0b78803e72a093f04007005b957a3e-780x665.png&w=1920&q=75)
- Enter your SMTP server username.
- Input the SMTP server password.
- Enter the email body for the content of the email.
- Next, select the PDF output URL in the "Attachment URLs" field.
![Setup PDF.co Configuration 2](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F3c8e02952be591a78ef1eb0b3043190e1eba3905-780x265.png&w=1920&q=75)
![Setup PDF.co Configuration 3](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F5060dfb031a6b365230f51fcc81e4825deafc472-780x280.png&w=1920&q=75)
Step 10: Send Email to PDF
Proceed to test the action by sending the email to PDF.co for processing the request.
![Send Email to PDF](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F9f96de62405ee8339ee5e3962925c5a03d5c73e5-780x785.png&w=1920&q=75)
Step 11: Email with Attachment
Below is the file that has been successfully sent as an attachment in an email.
![Email with Attachment](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F2niroq9z%2Fproduction%2F7e6cccae6bbed62d7259868a7d2511e6b03bc394-780x570.png&w=1920&q=75)
In this tutorial, we demonstrated how to automate the process of adding a client's information to a PDF and sending it as an email attachment. By integrating an online form with Google Sheets and utilizing automation tools, you can efficiently manage client data and streamline your communication process. This setup works seamlessly with any email provider, ensuring a smooth workflow regardless of your email domain. Thank you for following along, and happy automating!