Skip to content

On a schedule

Index new documents nightly and log each one in a sheet

Every night new documents are indexed into Pinecone, and your sheet shows each file's name, chunk count and the date it was indexed.

Runs
On a schedule
Apps
Google Sheets, Pinecone
AI
Not needed
Access
Pinecone write; sheet edit

Send this to your assistant

Create a ClickRuntime automation: every night at 2am, index new Google Docs from my Library folder into Pinecone and add a row to my Ingestion log sheet with each file's name, chunk count and date.

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

When a team relies on an index for search or answers, the first question after a wrong answer is whether the right document was in it. Without a log, nobody knows what was indexed or when.

Teams building document search, internal assistants or support bots use it to keep a plain record of what the index contains, readable by anyone with the sheet.

What you get out of it

  • Know what's in the index

    The sheet lists every indexed file with its date.

  • Spot problems quickly

    A file with zero or very few chunks stands out as an empty or failed export.

  • Shareable with non-technical people

    Anyone can open the sheet, no Pinecone login needed.

  • Runs overnight

    New documents are indexed by morning without anyone starting a job.

How it works

What happens, step by step

  1. Every night, ClickRuntime looks for Google Docs added to your folder since the last run.

  2. Each new document is split into chunks and written to your Pinecone index.

  3. A row is added to your log sheet with the file name, number of chunks and date.

Before it runs live

  • Connect your Google Sheets account and pick the spreadsheets it may use
  • Connect Pinecone

What you get

RunsOn a schedule
Index new documents nightly and log each one in a sheettoday, 9:00Succeeded
Google Sheets · Ingestion logReturns policy 2026 · 7 chunks · 2026-10-19 Wholesale terms · 12 chunks · 2026-10-19

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

  • Run it at a different time, more or less often, or only on weekdays
  • 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 Sheets 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.
document_ingestion_tracked_in_a_sheet.pyexample
import json
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state

SHEET_ID, Q = "your-spreadsheet-id", "'your-folder-id' in parents and mimeType='application/vnd.google-apps.document'"
HOST, NS = "https://kb-abc123.svc.aped-1234.pinecone.io", "library"  # 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):
    creds = Credentials(credentials.connection("google", "work"))
    drive = build("drive", "v3", credentials=creds, cache_discovery=False).files()
    new = drive.list(q=f"{Q} and createdTime > '{state.get('since') or '2026-01-01T00:00:00Z'}'",
                     fields="files(id,name,createdTime)").execute()["files"]
    if not new:
        return {"indexed": 0}
    rows = []
    for f in new:
        text = drive.export(fileId=f["id"], mimeType="text/plain").execute().decode("utf-8", "ignore")
        chunks = [text[i:i + 1500] for i in range(0, len(text), 1500)]
        upsert([{"_id": f"{f['id']}#{n}", "chunk_text": c, "file_name": f["name"]} for n, c in enumerate(chunks)])
        rows.append([f["name"], len(chunks), (event.scheduled_time or "")[:10], f["id"]])
    build("sheets", "v4", credentials=creds, cache_discovery=False).spreadsheets().values().append(
        spreadsheetId=SHEET_ID, range="Ingestion log!A:D", valueInputOption="RAW", body={"values": rows}).execute()
    state.set("since", max(f["createdTime"] for f in new))
    return {"indexed": len(new)}

FAQ

Common questions

Which files are indexed?
New Google Docs in the folder you choose. Convert PDFs to Google Docs in Drive to include them.
What is a chunk?
A section of about 1,500 characters. Long documents are split into chunks so searches can find the exact passage.
Are edited files re-indexed?
This version indexes new files. Ask for changed files to be included and their rows will be updated too.
What permissions does it need?
Pinecone write; sheet edit. 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 runs (on a schedule). Checks that find nothing to do 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 “Index new documents nightly and log each one in a sheet” from your assistant

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