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.
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
Every night, ClickRuntime looks for Google Docs added to your folder since the last run.
Each new document is split into chunks and written to your Pinecone index.
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
Build your own
Need it to work differently?
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
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?
What is a chunk?
Are edited files re-indexed?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Answer your standard questions about each new financial report in a sheet
Each quarter new financial reports are indexed in Pinecone, and the answers to your standard questions about each company are written to your sheet.
See how it worksScore new Google Maps reviews and keep them searchable
Each day new Google Maps reviews get a sentiment score in your sheet and are added to Pinecone, so you can search past feedback by topic.
See how it worksAnswer chat questions from your sheet data and documents together
People ask a question in your chat and get an answer that combines the figures in your Google Sheet with the guidance in your documents.
See how it worksKeep exploring
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.