Logo
Apdf tutorials 6 min read

Convert Email Attachments to PDF Automatically

Contracts arrive as Word files, invoice summaries as spreadsheets, kickoff decks as PowerPoint. Your archive wants PDFs — files that look the same on every device and that nobody edits by accident. So someone opens each attachment, exports it, downloads it and drags it into the right folder. Every time.

In this tutorial you'll hand that job to a Zap: every Office attachment that lands in Gmail is converted to PDF by Apdf and filed in Google Drive. No code, and no Microsoft Office anywhere in the loop.

What you'll build
A Zap that turns a client's attachments into PDFs in a Drive folder — Word, Excel and PowerPoint alike, one run per attachment: brightwave-services-agreement-2027.docx → PDF in Drive · 1 page
brightwave-q4-2026-invoices.xlsx → PDF in Drive · 1 page
winter-campaign-kickoff.pptx → PDF in Drive · 3 pages
Free plan: 1,000 PDF operations a month · multi-step Zaps need a paid Zapier plan
1

Connect Apdf to Zapier

The Zap authenticates with an API token. Create one in the Apdf dashboard under API → Tokens, then connect the Apdf app in Zapier:

  1. Create a new Zap. You'll add the Apdf step in a moment — Zapier asks for the connection the first time you pick an Apdf action.
  2. Paste the token into the API token field. A token belongs to one workspace, so every step runs against that workspace.

Behind the scenes, every conversion the Zap runs is one call to the Office to PDF API. The request the action sends for each attachment looks like this:

curl -X POST https://apdf.io/api/pdf/file/convert \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -d file="https://zapier-files.example.com/attachment/winter-campaign-kickoff.pptx" \
  -d async=true \
  -d webhook_url="ZAPIER_CALLBACK_URL"
2

Trigger on every new attachment

  1. Pick Gmail as the trigger app and New Attachment as the event, then connect the inbox the attachments arrive in.
  2. Narrow the Search String to received mail with Office files — it takes regular Gmail search operators: -in:sent {filename:docx filename:xlsx filename:pptx}
  3. Send yourself a test email with an Office attachment and click Test trigger.

New Attachment runs the Zap once per attachment, not once per email — so an email with a contract and a spreadsheet becomes two separate conversions, each with its own PDF.

3

Let only Office files through

The search string picks the emails, but the trigger still fires for every attachment on them — including the logo in the sender's signature and any PDF they attached. Those can't be converted, and the run fails with exactly that reason:

{
    "id": "01M56ZVW574J8GKNRTKG2SWA92",
    "created": "2026-10-18T07:50:50.000000Z",
    "status": "failed",
    "result": {
        "message": "The file could not be downloaded.",
        "errors": {
            "file": "The file seems to be not a valid Office document"
        }
    }
}

Add a Filter step between the trigger and the conversion so only Office files go on:

  1. Click the plus icon below the trigger and choose Filter.
  2. Pick the attachment's file name from the trigger's test data, choose (Text) Ends with and enter .docx.
  3. Click Add Or rule group twice and repeat the rule for .xlsx and .pptx. Text rules ignore case, so Report.DOCX passes too.
Tip: The conversion also takes the older and open formats — .doc, .xls, .ppt, .odt, .ods, .odp and .rtf. Add a rule group for each one your senders actually use.
4

Convert the attachment to PDF

  1. Add an action step, search for Apdf and pick Convert Office Document to PDF.
  2. In Office file, map the Gmail trigger's Attachment field.
  3. Test the step — a real conversion of your test attachment runs, and the PDF comes back.

The conversion runs as a background job. In a live Zap the step simply waits until Apdf reports back, so large decks never run into Zapier's time limit for a single step. Only the test in the editor waits briefly: if a big file isn't done in time, the test says Apdf is still working on the job — test again or skip the test. This is the finished job Apdf handed back for the PowerPoint deck in our run:

{
    "id": "01M56ZTW5BM9R55SRZ2SYYPQVX",
    "created": "2026-10-18T07:50:17.000000Z",
    "status": "successful",
    "result": {
        "file": "https://apdf-files.s3.eu-central-1.amazonaws.com/0f2f781f6ad47a397c80b.pdf",
        "expiration": "2026-10-18T08:50:21.010739Z",
        "pages": 3,
        "size": 105555
    }
}

In the Zap this becomes the step's output: File, File URL (expires after an hour), File URL Expires At, Pages, File Size (Bytes) and Job ID.

Heads up: Map File in the next step, not the File URL. Apdf deletes generated files after one hour; File is a copy in Zapier's own file storage, so it's still there when a Zap is delayed or a task is replayed later.
5

File the PDF in Google Drive

  1. Add an action step: Google Drive → Upload File, then pick the drive and the folder for the PDFs.
  2. In File, map the Apdf step's File.
  3. In File Name, build a name from mapped fields — for example the email's date and the attachment's name — and end it with .pdf.
  4. Test the step, then publish the Zap.

From now on, attachments file themselves. Here are the first pages of the three PDFs from our test email — the agreement, the invoice summary and the kickoff deck, converted exactly as the Zap converts them:

The first pages of three PDFs converted by Apdf: a Word services agreement, an Excel invoice summary with totals and the title slide of a PowerPoint kickoff deck
Tip: Documents set in the standard Office fonts (Calibri, Cambria, Arial, Times New Roman) keep their line and page breaks. A font the converter doesn't have is replaced by a similar one, which can move text onto a new page — worth a look at the first few PDFs a new sender produces.
Plan note: The free plan includes 1,000 PDF operations a month, and every converted attachment counts as one. Files can be up to 100 MB. On the Zapier side, Zaps with more than two steps and filters need a paid Zapier plan.

Where to go from here

The PDFs are filed — and the ones you send on can tell you who reads them.

After the API call

Your code made the PDF.
Then it went dark.

Opened, read, signed or ignored — you never see any of it. Send the PDFs you generate as personal links, and every open, page read, comment and signature comes back to your software as a webhook. Need it signed? Same link. Same account, same API key, one more call.

Your PDF, after sending Live
document:loaded CFO
page:read p4 · 38s
signature:signed 11:48

API · Webhook · MCP