Skip to content

On a schedule

Index reports in Pinecone and write an analysis to Google Docs

Your report documents are indexed in Pinecone, and each quarter an AI analysis drawing on them is written into a new Google Doc.

Runs
On a schedule
Apps
Google Docs, Pinecone
AI
Yes, uses the built-in AI allowance
Access
Pinecone key; Docs edit on shared folder

Send this to your assistant

Create a ClickRuntime automation: index the earnings-report docs in my folder into Pinecone, then each quarter write an AI analysis of the company into a new Google Doc.

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 analyst follows a handful of companies and keeps their quarterly reports in a Drive folder. Writing each quarter's summary means rereading hundreds of pages to find the figures and statements that changed.

Indexing the reports means the relevant passages can be pulled up for each question, and a first-draft analysis lands in Docs each quarter. The analyst's time goes into judgement rather than searching.

What you get out of it

  • Analysis grounded in your documents

    The write-up draws on passages from your own reports. Claims can be checked against the source.

  • A first draft every quarter

    The analysis is waiting in Docs when the period closes. Your work starts from a structured draft.

  • Reports stay searchable

    Once indexed, the same collection can answer other questions later. The archive becomes a reference, not a pile of PDFs.

  • Only new files are processed

    Documents already indexed are skipped. Adding a new report each quarter costs only that report's processing.

How it works

What happens, step by step

  1. On each scheduled run, ClickRuntime looks for report documents in your folder that it has not indexed yet.

  2. New documents are split into passages and stored in your Pinecone index.

  3. It then searches the index for the passages most relevant to your analysis questions.

  4. AI writes the analysis from those passages and the result is saved as a new Google Doc.

Before it runs live

  • Connect Google Docs
  • Connect Pinecone

What you get

RunsOn a schedule
Index reports in Pinecone and write an analysis to Google Docstoday, 9:00Succeeded
Google Docs · Quarterly analysisContoso Q3: revenue up 8% on services; gross margin down 1.2 pts; guidance held; supplier risk noted.

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
  • 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 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.
index_documents_into_pinecone_and_write_analysis_to_a_doc.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, state, http, ai

INDEX_HOST = "https://your-index.svc.your-region.pinecone.io"
QUESTION = "Revenue, margins, guidance and key risks this quarter"

@on_trigger
def run(event):
    pc = {"Api-Key": credentials.secret("PINECONE_API_KEY"), "X-Pinecone-API-Version": "2025-04"}
    creds = Credentials(credentials.connection("google", "work"))
    docs = build("docs", "v1", credentials=creds, cache_discovery=False).documents()
    files = build("drive", "v3", credentials=creds, cache_discovery=False).files().list(q="'your-folder-id' in parents").execute()["files"]
    indexed = state.get("indexed") or []
    for doc_id in [f["id"] for f in files if f["id"] not in indexed]:
        body = docs.get(documentId=doc_id).execute()["body"]["content"]
        text = "".join(e["textRun"]["content"] for p in body for e in p.get("paragraph", {}).get("elements", []) if "textRun" in e)
        records = [{"_id": f"{doc_id}-{i}", "text": text[i:i + 1500]} for i in range(0, len(text), 1500)]
        http.post(f"{INDEX_HOST}/records/namespaces/reports/upsert", headers={**pc, "Content-Type": "application/x-ndjson"},
                  data="\n".join(__import__("json").dumps(r) for r in records))
        indexed.append(doc_id)
    state.set("indexed", indexed)
    hits = http.post(f"{INDEX_HOST}/records/namespaces/reports/search", headers=pc,
                     json={"query": {"inputs": {"text": QUESTION}, "top_k": 12}}).json()["result"]["hits"]
    context = "\n---\n".join(h["fields"]["text"] for h in hits)
    analysis = ai.generate(f"Using only these excerpts, write a company analysis covering {QUESTION}:\n{context}", max_output_tokens=1800).text
    doc = docs.create(body={"title": "Quarterly analysis"}).execute()
    docs.batchUpdate(documentId=doc["documentId"], body={"requests": [{"insertText": {"location": {"index": 1}, "text": analysis}}]}).execute()
    return {"indexed": len(indexed), "doc": doc["documentId"]}

FAQ

Common questions

What kinds of documents can be indexed?
Google Docs in the chosen folder work directly. PDFs can be converted to Docs in Drive first, which keeps their text.
Which questions does the analysis answer?
By default it covers revenue, margins, guidance and risks. You can change the list of questions to match how you review a company.
Do I need my own Pinecone account?
Yes. The documents are stored in your Pinecone index using your API key, so you control the data and can delete it at any time.
What permissions does it need?
Pinecone key; Docs edit on shared folder. 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 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 reports in Pinecone and write an analysis to Google Docs” from your assistant

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