Skip to content

Every 15 minutes

Create document drafts from new contract PDFs in Drive

Each contract PDF added to your Drive folder produces a draft from your Doc template with the parties, dates and amounts filled in.

Runs
Every 15 minutes
Apps
Google Docs, Google Drive
AI
Yes, uses the built-in AI allowance
Access
Drive read+write; Docs write

Send this to your assistant

Create a ClickRuntime automation: when a new contract PDF is added to my Drive folder, extract the parties, dates and amounts and create a draft from my Doc template.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A small legal practice receives signed contracts as PDFs and writes a one-page summary of each for the client file. Every summary means reading the PDF, finding the parties, term, notice period and fees, and typing them into the same template.

Having the template filled in as soon as the PDF lands means the lawyer reviews and corrects a draft instead of retyping the same facts from scratch.

What you get out of it

  • Less retyping

    Names, dates and amounts are copied into the template for you, which removes the slowest and most error-prone part of the job.

  • The same format for every contract

    Every draft uses your template, so summaries in client files look and read the same.

  • Drafts ready when you are

    The document is waiting in Drive by the time someone opens the folder, without anyone starting it.

  • A person still signs off

    The result is a draft to review, so the details are checked before anything goes to a client.

How it works

What happens, step by step

  1. Every few minutes ClickRuntime checks your contracts folder in Google Drive for new PDFs.

  2. It skips any PDF it has already handled.

  3. AI reads the contract and pulls out the parties, key dates and amounts.

  4. It makes a copy of your Doc template, fills in those details and saves the draft in your folder.

Before it runs live

  • Connect Google Docs
  • Connect Google Drive

What you get

RunsEvery 15 minutes
Create document drafts from new contract PDFs in Drivetoday, 9:00Succeeded
Google Docs · DraftSummary - Acme_Northwind_Services.pdf: parties Acme Ltd and Northwind LLP, 1 Jul 2026 to 30 Jun 2027, fee 48,000.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Google Docs and Google Drive steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
doc_drafts_from_new_pdfs_in_drive.pyexample
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
from clickruntime import on_trigger, credentials, state, ai, report_fetched, http

FOLDER, TEMPLATE, FIELDS = "contracts-folder-id", "template-doc-id", ["parties", "start_date", "end_date", "amount"]

@on_trigger
def run(event):
    creds = Credentials(credentials.connection("google", "work"))
    drive = build("drive", "v3", credentials=creds, cache_discovery=False).files()
    seen = state.get("seen") or []
    pdfs = [f for f in drive.list(q=f"'{FOLDER}' in parents and mimeType='application/pdf' and trashed=false",
                                  fields="files(id,name)").execute()["files"] if f["id"] not in seen]
    report_fetched(len(pdfs))
    if not pdfs:
        return {"summary": "No new PDFs"}
    docs = build("docs", "v1", credentials=creds, cache_discovery=False).documents()
    for f in pdfs:
        text = drive.copy(fileId=f["id"], body={"mimeType": "application/vnd.google-apps.document"}).execute()
        body = http.get(f"https://www.googleapis.com/drive/v3/files/{text['id']}/export", params={"mimeType": "text/plain"},
                        headers={"Authorization": f"Bearer {creds.token}"}).text[:12000]
        drive.delete(fileId=text["id"]).execute()
        data = ai.generate(f"Extract {FIELDS} from this contract:\n{body}", max_output_tokens=200,
                           json_schema={"type": "object", "properties": {k: {"type": "string"} for k in FIELDS}}).json
        draft = drive.copy(fileId=TEMPLATE, body={"name": f"Summary - {f['name']}", "parents": [FOLDER]}).execute()
        docs.batchUpdate(documentId=draft["id"], body={"requests": [{"replaceAllText": {"containsText": {"text": "{{" + k + "}}"},
                         "replaceText": v or ""}} for k, v in data.items()]}).execute()
        seen.append(f["id"])
    state.set("seen", seen[-500:])
    return {"drafts": len(pdfs)}

FAQ

Common questions

Which fields can it fill in?
Anything you mark in the template with a placeholder, such as parties, start date, end date, notice period and fees. Add or remove placeholders to change what is filled.
What about scanned PDFs?
PDFs that are only images need text recognition first. Drive can convert scanned PDFs to text, but check those drafts carefully.
Where are the drafts saved?
In the same folder as the PDF or a drafts folder you choose, named after the contract file so the two are easy to match.
What permissions does it need?
Drive read+write; Docs write. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Create document drafts from new contract PDFs in Drive” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.