Skip to content

Every 15 minutes

Sort new Drive files into the right folders

Files dropped into your Drive inbox are filed as invoices, contracts, HR or other, and your team gets a summary in Slack.

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

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, classify new files in my Drive 'Inbox' folder as invoice, contract, HR or other, move each to the matching folder and post a summary to #ops.

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

An office manager at a twenty-person firm has one shared Drive folder where everyone drops paperwork: supplier invoices, signed contracts, sick notes, insurance letters. Once a week she sorts it by hand. Until then, the accountant cannot find invoices and contracts sit next to personal HR documents.

Filing each document shortly after it arrives keeps the inbox empty and puts papers where the people who need them already look.

What you get out of it

  • Invoices reach finance the same day

    Moving invoices into the finance folder as they arrive means they are seen before the due date, not at the end of the week.

  • HR documents stay out of shared view

    Personal documents are moved into the HR folder quickly, so they do not sit in a folder the whole office can open.

  • No weekly sorting session

    The hour spent opening and dragging files each week goes away. Only the files marked other need a person to decide.

  • A record of what was filed where

    The Slack summary lists each file and its new folder, so anyone can find a document without searching, and mistakes are easy to spot and move back.

How it works

What happens, step by step

  1. Every 15 minutes ClickRuntime looks for new files in your Inbox folder in Google Drive.

  2. AI reads the start of each file and decides whether it is an invoice, a contract, an HR document or something else.

  3. Each file is moved to the folder for its category.

  4. A short summary of what was filed and where is posted in your #ops Slack channel.

Before it runs live

  • Connect Google Drive
  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)

What you get

RunsEvery 15 minutes
Sort new Drive files into the right folderstoday, 9:00Succeeded
Slack · #opsFiled from Inbox: Acme_invoice_0412.pdf -> invoice, Northwind_MSA_signed.pdf -> contract

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 Google Sheets
  • Combine it with other Google Drive and Slack 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.
classify_new_drive_documents_into_folders.pyexample
from clickruntime import on_trigger, credentials, notify, ai, report_fetched, http

INBOX = "inbox-folder-id"
FOLDERS = {"invoice": "invoices-id", "contract": "contracts-id", "hr": "hr-id", "other": "other-id"}
API = "https://www.googleapis.com/drive/v3/files"

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
    files = http.get(API, headers=h, params={"q": f"'{INBOX}' in parents and trashed=false",
                                            "fields": "files(id,name)"}).json()["files"]
    report_fetched(len(files))
    if not files:
        return {"summary": "Inbox empty"}
    lines = []
    for f in files:
        text = http.get(f"{API}/{f['id']}/export", headers=h, params={"mimeType": "text/plain"}).text[:2000]
        label = ai.generate(f"File: {f['name']}\n{text}\nAnswer with one word: invoice, contract, hr or other.",
                            max_output_tokens=10).text.strip().lower()
        label = label if label in FOLDERS else "other"
        http.patch(f"{API}/{f['id']}", headers=h, params={"addParents": FOLDERS[label], "removeParents": INBOX})
        lines.append(f"{f['name']} -> {label}")
    notify.slack("Filed from Inbox:\n" + "\n".join(lines), channel="#ops")
    return {"filed": len(files)}

FAQ

Common questions

Can I add my own categories?
Yes. List the categories you want, such as receipts or purchase orders, and give each one a target folder. Keep the descriptions short and distinct so files are not confused between two similar categories.
What happens to files it is unsure about?
They go to the other folder and are flagged in the Slack summary, so someone can file them by hand.
Does it rename files?
Not by default. It only moves them. Renaming to a pattern such as date and supplier name can be added if your team wants consistent file names.
What permissions does it need?
Drive read+write; Slack chat: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 “Sort new Drive files into the right folders” from your assistant

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