On a schedule
List Google Drive folder files in Google Sheets
A sheet tab keeps an index of every file in a Drive folder and its subfolders, with folder path, type, owner, last modified and link.
- Runs
- On a schedule
- Apps
- Google Drive, Google Sheets
- AI
- Not needed
- Access
- Google Drive read; Google Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: every night at 1am, list every file in my Client Deliverables Drive folder, including subfolders, in the Index tab of my sheet with its folder path, file type, owner, last modified date and link.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Drive search is good for finding one file, not for seeing everything in a project at once. When a client asks what was delivered, or an audit needs a list of documents, someone ends up clicking through folders and copying names.
This automation keeps an index of a Drive folder and all its subfolders in a sheet tab, rebuilt nightly with the folder path, owner, file type, last modified date and link of every file.
Agencies, legal and compliance teams, and anyone handing over a project use it as a living table of contents.
What you get out of it
Every file in one table
Nested subfolders are flattened into a single list with the folder path kept as a column.
Spot stale or missing documents
Sort by modified date to see what has not been touched, or filter by folder to find gaps.
Owners are visible
The owner column shows who to ask about a file, and highlights files owned by people who have left.
Shareable without Drive access
Send the index to someone who only needs to know what exists.
Rebuilt nightly
Deleted files drop off and new ones appear without upkeep.
How it works
What happens, step by step
Every night ClickRuntime walks through the Drive folder you choose and all of its subfolders.
For each file it notes the folder path, name, type, owner, last modified date and link.
The Index tab is cleared and rewritten, newest changes first.
Before it runs live
- Connect Google Drive
- Connect your Google Sheets account and pick the spreadsheets it may use
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 Drive and Google Sheets steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, report_fetched
ROOT_FOLDER = "your-folder-id"
SHEET_ID = "your-spreadsheet-id"
FOLDER = "application/vnd.google-apps.folder"
@on_trigger
def run(event):
creds = Credentials(credentials.connection("google", "work"))
drive = build("drive", "v3", credentials=creds, cache_discovery=False).files()
rows, queue = [], [(ROOT_FOLDER, "")]
while queue:
folder_id, path = queue.pop()
token = None
while True:
res = drive.list(q=f"'{folder_id}' in parents and trashed = false", pageSize=1000, pageToken=token,
fields="nextPageToken, files(id,name,mimeType,modifiedTime,owners(emailAddress),webViewLink)").execute()
for f in res["files"]:
if f["mimeType"] == FOLDER:
queue.append((f["id"], f"{path} / {f['name']}".strip(" /")))
else:
kind = f["mimeType"].split("/")[-1].replace("vnd.google-apps.", "Google ").upper() if "/" in f["mimeType"] else f["mimeType"]
rows.append([path or "(top)", f["name"], kind, (f.get("owners") or [{}])[0].get("emailAddress", ""),
f["modifiedTime"][:10], f["webViewLink"]])
token = res.get("nextPageToken")
if not token:
break
report_fetched(len(rows))
rows.sort(key=lambda r: r[4], reverse=True)
tab = build("sheets", "v4", credentials=creds, cache_discovery=False).spreadsheets().values()
tab.clear(spreadsheetId=SHEET_ID, range="Index!A:F").execute()
tab.update(spreadsheetId=SHEET_ID, range="Index!A1", valueInputOption="RAW",
body={"values": [["Folder", "File", "Type", "Owner", "Modified", "Link"]] + rows}).execute()
return {"files": len(rows)}FAQ
Common questions
Does it work for shared drives?
How large a folder can it handle?
Can it flag files shared publicly?
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
Turn video ideas in a sheet into finished videos in Drive
Every hour the next ready idea in your Videos sheet becomes a video in your Drive, with the link and status written back to the sheet.
See how it worksTurn a sheet of topics into article drafts in Drive
Each day the next topic in your Content sheet becomes a 1,000-word article draft in Google Docs, with its link added to the sheet.
See how it worksLog job postings that match your CV in a sheet
Each morning, new postings from your job feeds are scored against your CV and the good matches are added to your Jobs sheet.
See how it worksKeep exploring
Set up “List Google Drive folder files in Google Sheets” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.