read_doc from yesterday reads an existing Doc. For your thesis methodology updates you sometimes need a new Doc — a fresh section for a new data batch, a weekly summary. How do you create one?
GOOGLEDOCS_CREATE_DOCUMENT — the naming pattern is CREATE_ for write actions. Takes a title and returns the new doc dict including its ID.
Exact pattern. GOOGLEDOCS_CREATE_DOCUMENT takes a title parameter and creates a new empty document in your Drive. Returns the doc dict — including documentId — which you can use to share, append content, or pass to read_doc:
result = toolset.execute_action(
Action.GOOGLEDOCS_CREATE_DOCUMENT,
{"title": "Thesis methodology notes — Week 7"}
)
doc_id = result.get("documentId", "")
print(f"Created doc: {doc_id}")It creates an empty doc? I can't add content in the same call?
Just the title in one call — that's how the Docs create action works. Adding content requires a separate batchUpdate call that's outside the scope of this track. For the capstone, the empty doc is the container — you share it with the advisor and they see a new structured document appear in their Drive:
def create_doc(title: str) -> dict:
result = toolset.execute_action(
Action.GOOGLEDOCS_CREATE_DOCUMENT,
{"title": title}
)
doc_id = result.get("documentId", "")
print(f"Doc '{title}' created: {doc_id}")
return resultI can generate a new thesis section document every time I start a new analysis batch — all with a function call and a date-stamped title.
Your advisor gets a new, clearly labelled document every week. Your Google Drive organises itself.
read_doc → create_doc: the full Docs read-write loop. Same two-function pattern as Gmail, Calendar, Sheets. Every new app is just a new namespace.
Write action — verify it in Google Drive after creation. New docs are created with your account as owner and no sharing settings. For collaborative work you'll need to share manually after creation, or use a Drive sharing API call. The capstone uses the doc ID from creation to reference the document in the workflow output.
Param: title — the new document title
{"documentId": "...", "title": "...", "body": {...empty...}}
create_doc(title) → get documentId → pass to read_doc(doc_id) to verify
New docs are owned by your account. Share manually in Drive or via Drive API for collaborative access.
CREATE_DOCUMENT creates a blank document. To add content, use GOOGLEDOCS_BATCH_UPDATE with insertText requests. For this track, create then separately populate via copy-paste or a separate write action.
read_doc from yesterday reads an existing Doc. For your thesis methodology updates you sometimes need a new Doc — a fresh section for a new data batch, a weekly summary. How do you create one?
GOOGLEDOCS_CREATE_DOCUMENT — the naming pattern is CREATE_ for write actions. Takes a title and returns the new doc dict including its ID.
Exact pattern. GOOGLEDOCS_CREATE_DOCUMENT takes a title parameter and creates a new empty document in your Drive. Returns the doc dict — including documentId — which you can use to share, append content, or pass to read_doc:
result = toolset.execute_action(
Action.GOOGLEDOCS_CREATE_DOCUMENT,
{"title": "Thesis methodology notes — Week 7"}
)
doc_id = result.get("documentId", "")
print(f"Created doc: {doc_id}")It creates an empty doc? I can't add content in the same call?
Just the title in one call — that's how the Docs create action works. Adding content requires a separate batchUpdate call that's outside the scope of this track. For the capstone, the empty doc is the container — you share it with the advisor and they see a new structured document appear in their Drive:
def create_doc(title: str) -> dict:
result = toolset.execute_action(
Action.GOOGLEDOCS_CREATE_DOCUMENT,
{"title": title}
)
doc_id = result.get("documentId", "")
print(f"Doc '{title}' created: {doc_id}")
return resultI can generate a new thesis section document every time I start a new analysis batch — all with a function call and a date-stamped title.
Your advisor gets a new, clearly labelled document every week. Your Google Drive organises itself.
read_doc → create_doc: the full Docs read-write loop. Same two-function pattern as Gmail, Calendar, Sheets. Every new app is just a new namespace.
Write action — verify it in Google Drive after creation. New docs are created with your account as owner and no sharing settings. For collaborative work you'll need to share manually after creation, or use a Drive sharing API call. The capstone uses the doc ID from creation to reference the document in the workflow output.
Param: title — the new document title
{"documentId": "...", "title": "...", "body": {...empty...}}
create_doc(title) → get documentId → pass to read_doc(doc_id) to verify
New docs are owned by your account. Share manually in Drive or via Drive API for collaborative access.
CREATE_DOCUMENT creates a blank document. To add content, use GOOGLEDOCS_BATCH_UPDATE with insertText requests. For this track, create then separately populate via copy-paste or a separate write action.
Create a free account to get started. Paid plans unlock all tracks.