search_sheets gave you the discovery step for Sheets. Your research notes live in a Google Doc — the same running document your advisor edits. How do you read its content programmatically?
GOOGLEDOCS_GET_DOCUMENT_BY_ID — same naming pattern as Gmail's message-by-id action. Takes a document ID and returns the doc content as a dict.
Exactly right pattern recognition. The Docs API returns a rich JSON structure — title, body sections, paragraph elements. For the capstone you only need the title and a text summary. .get('title') and .get('body') give you those:
result = toolset.execute_action(
Action.GOOGLEDOCS_GET_DOCUMENT_BY_ID,
{"document_id": "your-doc-id"}
)
title = result.get("title", "")
body = result.get("body", {})
print(f"Doc: {title}")search_sheets uses GOOGLESHEETS_SEARCH_SPREADSHEETS. Is there a search for Docs too, or do I need to know the ID?
No Docs search action in this track. For the capstone you'll use the ID directly — get it from the Doc URL (docs.google.com/document/d/DOCID/edit). In a real workflow, you'd search Drive for the file and extract the ID from the result:
def read_doc(doc_id: str) -> dict:
result = toolset.execute_action(
Action.GOOGLEDOCS_GET_DOCUMENT_BY_ID,
{"document_id": doc_id}
)
title = result.get("title", "")
print(f"Reading doc: {title}")
return resultMy shared research notes doc comes back as a Python dict. The body structure is complex but the title is accessible — that's enough for the advisor email subject line.
The full body is there for Week 4 when you extract the first paragraph as a LinkedIn post. Today, title is sufficient.
Same .get() reflex, same safe parse, different app namespace. I didn't need a tutorial for Docs because I understood the pattern from Gmail.
The Docs body is deeply nested — paragraphs → paragraph elements → text runs. For the capstone you only need title. If you need body text, extract it with body.get('content', []) and iterate the paragraph elements. Don't try to parse the full structure for this lesson.
Param: document_id — the ID from the Doc URL
{"title": "...", "body": {"content": [...nested paragraphs...]}, "documentId": "..."}
From the URL: docs.google.com/document/d/**DOCID**/edit. Copy the long string between /d/ and the next /.
Deeply nested. Access result.get('title') for quick metadata. Body text requires iterating content → paragraph → elements → textRun. For simple title extraction, use doc.get("title", "Untitled") — no body parsing needed.
Store the document ID as a variable at the top of your script. Passing it as a function parameter makes your workflow reusable across multiple documents without code changes.
search_sheets gave you the discovery step for Sheets. Your research notes live in a Google Doc — the same running document your advisor edits. How do you read its content programmatically?
GOOGLEDOCS_GET_DOCUMENT_BY_ID — same naming pattern as Gmail's message-by-id action. Takes a document ID and returns the doc content as a dict.
Exactly right pattern recognition. The Docs API returns a rich JSON structure — title, body sections, paragraph elements. For the capstone you only need the title and a text summary. .get('title') and .get('body') give you those:
result = toolset.execute_action(
Action.GOOGLEDOCS_GET_DOCUMENT_BY_ID,
{"document_id": "your-doc-id"}
)
title = result.get("title", "")
body = result.get("body", {})
print(f"Doc: {title}")search_sheets uses GOOGLESHEETS_SEARCH_SPREADSHEETS. Is there a search for Docs too, or do I need to know the ID?
No Docs search action in this track. For the capstone you'll use the ID directly — get it from the Doc URL (docs.google.com/document/d/DOCID/edit). In a real workflow, you'd search Drive for the file and extract the ID from the result:
def read_doc(doc_id: str) -> dict:
result = toolset.execute_action(
Action.GOOGLEDOCS_GET_DOCUMENT_BY_ID,
{"document_id": doc_id}
)
title = result.get("title", "")
print(f"Reading doc: {title}")
return resultMy shared research notes doc comes back as a Python dict. The body structure is complex but the title is accessible — that's enough for the advisor email subject line.
The full body is there for Week 4 when you extract the first paragraph as a LinkedIn post. Today, title is sufficient.
Same .get() reflex, same safe parse, different app namespace. I didn't need a tutorial for Docs because I understood the pattern from Gmail.
The Docs body is deeply nested — paragraphs → paragraph elements → text runs. For the capstone you only need title. If you need body text, extract it with body.get('content', []) and iterate the paragraph elements. Don't try to parse the full structure for this lesson.
Param: document_id — the ID from the Doc URL
{"title": "...", "body": {"content": [...nested paragraphs...]}, "documentId": "..."}
From the URL: docs.google.com/document/d/**DOCID**/edit. Copy the long string between /d/ and the next /.
Deeply nested. Access result.get('title') for quick metadata. Body text requires iterating content → paragraph → elements → textRun. For simple title extraction, use doc.get("title", "Untitled") — no body parsing needed.
Store the document ID as a variable at the top of your script. Passing it as a function parameter makes your workflow reusable across multiple documents without code changes.
Create a free account to get started. Paid plans unlock all tracks.