# Save Gmail emails as PDFs automatically Gmail to PDF on autopilot. Save every email with a label, or from a sender, as a PDF in Google Drive with Apps Script or Zapier. **Quick answer.** Pick which emails to keep, for example everything with the label "Receipts". A small script or a Zapier step takes each new email, html-pdf.com turns it into a PDF that looks like the original message, and the PDF is saved to a Google Drive folder. ## What you'll build You get a Drive folder that fills itself. Each matching email becomes one PDF with the sender, date, subject and the full message, including formatting and images. People use this for expense receipts, supplier invoices sent in the email body, signed approvals, legal or HR records, and handing a client a clean copy of a conversation. Printing one email to PDF by hand works fine. This is for when you need it to happen every time. ## What you need - **A Gmail or Google Workspace account.** - **A rule for which emails to save.** A label is easiest. Create one called `Save as PDF` and add a Gmail filter that applies it. - **A Google Drive folder** for the PDFs. - **An API key** from [html-pdf.com](https://html-pdf.com/login). New accounts get 100 free pages once, with no card. Emails are already written as web pages behind the scenes, and html-pdf.com turns that web page into a PDF, so you don't need to design anything. ## Option 1 with Apps Script (free, runs every 15 minutes) 1. Go to [script.google.com](https://script.google.com) and create a new project. 2. Paste the code below. Put your Drive folder ID in `FOLDER_ID` (it's the last part of the folder's URL). 3. In **Project Settings → Script properties**, add `HTML_PDF_KEY` with your key. 4. Run `savePdfs` once and approve the permissions. 5. Open **Triggers**, click **Add Trigger**, choose `savePdfs`, **Time-driven**, every 15 minutes. ```js const FOLDER_ID = "your-folder-id"; const LABEL = "Save as PDF"; const DONE = "Saved as PDF"; function savePdfs() { const key = PropertiesService.getScriptProperties().getProperty("HTML_PDF_KEY"); const done = GmailApp.getUserLabelByName(DONE) || GmailApp.createLabel(DONE); const folder = DriveApp.getFolderById(FOLDER_ID); const threads = GmailApp.search(`label:"${LABEL}" -label:"${DONE}"`, 0, 20); threads.forEach(thread => { thread.getMessages().forEach(m => { const header = `
Map the Gmail body HTML field here
", "margin": "15mm", "filename": "email.pdf", "response": "url" } ``` Email HTML often contains quotes, so building the JSON in a **Code by Zapier** step is more reliable than pasting the body directly. The [Zapier guide](https://html-pdf.com/guides/zapier) has the full setup, and n8n users can use the **Gmail Trigger** and **HTTP Request** nodes from the [n8n guide](https://html-pdf.com/guides/n8n). ## Ask your AI agent If Claude or ChatGPT can read your email and has the [html-pdf.com MCP server](https://html-pdf.com/pdf-mcp-server) connected, you can ask for one off archives. > Find the emails from Acme Supplies about order 7781, put them in date order as one clean document with a short summary at the top, and use html-pdf to make it a PDF. For setup, see the [Claude guide](https://html-pdf.com/guides/claude) and [ChatGPT guide](https://html-pdf.com/guides/chatgpt). ## FAQ ### Can I save Gmail emails as PDF without any tools? Yes, one at a time. Open the email, click **Print all** and choose **Save as PDF**. Automation helps when you need many emails saved without clicking. ### Do images in the email show up in the PDF? Images hosted online usually appear, since the renderer loads them like a browser would. Images that need you to be signed in, or tracking pixels that are blocked, may not. ### Does html-pdf.com keep my emails? No. The HTML is not stored, and download links expire after 24 hours. The PDFs live only in your own Drive. ### How much does it cost? One credit per PDF page. Most emails are one or two pages. Packs start at $10 for 1,000 pages, and purchased credits never expire.