Skip to content

Every 15 minutes

Keep a Pinecone index in step with a Drive folder

New and edited files in your Drive folder are added to Pinecone within minutes, and files you remove are taken out of the index.

Runs
Every 15 minutes
Apps
Google Drive, Pinecone
AI
Not needed
Access
Drive read; Pinecone write

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, index new or changed Google Docs in my Drive Docs folder into Pinecone namespace company and remove the entries for files that were deleted.

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 search or chatbot built on your documents is only as good as its index. When someone updates a policy in Drive and the index still holds last year's version, people get confident, wrong answers, which is worse than no answer.

Teams running internal assistants, support bots or document search use it so their index follows the folder automatically, without someone re-uploading files after every edit.

What you get out of it

  • Answers stay current

    Edited documents are re-indexed within minutes, so old wording does not linger.

  • Deleted means gone

    Removing a file from the folder removes it from the index, so retired policies stop showing up.

  • Only changes are processed

    Unchanged files are skipped, which keeps each check quick and cheap.

  • The folder is the control panel

    Adding or removing a document in Drive is all anyone needs to do.

How it works

What happens, step by step

  1. Every 15 minutes, ClickRuntime lists the files in your Drive folder.

  2. It compares them with what it indexed last time to find new, edited and removed files.

  3. Edited and removed files have their old entries deleted from Pinecone.

  4. New and edited files are split into chunks and added to your Pinecone index with their file name.

Before it runs live

  • Connect Google Drive
  • Connect Pinecone

What you get

RunsEvery 15 minutes
Keep a Pinecone index in step with a Drive foldertoday, 9:00Succeeded
Pinecone · companyUpdated: Leave policy 2026, Expenses guide · Removed: Travel policy 2024

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
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Google Drive and Pinecone 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.
keep_a_drive_folder_synced_into_pinecone.pyexample
import json
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, report_fetched, credentials, http, state

Q = "'your-folder-id' in parents and trashed=false and mimeType='application/vnd.google-apps.document'"
HOST, NS = "https://docs-abc123.svc.aped-1234.pinecone.io", "company"  # your index host and namespace
def upsert(records):
    http.post(f"{HOST}/records/namespaces/{NS}/upsert", data="\n".join(json.dumps(r) for r in records[:96]), headers={
        "Api-Key": credentials.secret("PINECONE_API_KEY"), "X-Pinecone-API-Version": "2025-04", "Content-Type": "application/x-ndjson"}).raise_for_status()

@on_trigger
def run(event):
    drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    files = {f["id"]: f for f in drive.files().list(q=Q, fields="files(id,name,modifiedTime)", pageSize=1000).execute()["files"]}
    known = state.get("known") or {}
    changed = [f for i, f in files.items() if known.get(i) != f["modifiedTime"]]
    removed = [i for i in known if i not in files]
    report_fetched(len(changed) + len(removed))
    if not changed and not removed:
        return {"changed": 0}
    pc = {"Api-Key": credentials.secret("PINECONE_API_KEY"), "X-Pinecone-API-Version": "2025-04"}
    for fid in removed + [f["id"] for f in changed if f["id"] in known]:
        http.post(f"{HOST}/vectors/delete", headers=pc, json={"namespace": NS, "filter": {"file_id": {"$eq": fid}}})
    for f in changed:
        text = drive.files().export(fileId=f["id"], mimeType="text/plain").execute().decode("utf-8", "ignore")
        upsert([{"_id": f"{f['id']}#{n}", "chunk_text": text[i:i + 1500], "file_id": f["id"], "file_name": f["name"]}
                for n, i in enumerate(range(0, len(text), 1500))])
    state.set("known", {i: f["modifiedTime"] for i, f in files.items()})
    return {"changed": len(changed), "removed": len(removed)}

FAQ

Common questions

Which file types are indexed?
Google Docs and plain text files. PDFs and Word files can be added by converting them to Google Docs in Drive first.
How are long documents handled?
Each document is split into chunks of about 1,500 characters, and each chunk is stored with the file name and ID so answers can name their source.
Does it include subfolders?
This version watches one folder. Ask for subfolders to be included and each one is listed on every check.
What permissions does it need?
Drive read; Pinecone write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's 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 “Keep a Pinecone index in step with a Drive folder” from your assistant

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