Google Docs Provider¶
The google_docs provider renders SlideFlow output into Google Docs documents using section markers (for example {{SECTION:intro}}) as logical anchors.
It reuses presentation.slides[] from the core schema:
slides[].idmaps to a marker id in the document template.- replacements/charts scoped to that
slide.idrun inside the matching section.
Setup Checklist¶
- Enable APIs in your Google Cloud project:
- Google Docs API
- Google Drive API
- Create a service account.
- Share the template document (and destination Drive folders) with that service account.
- Provide credentials via:
provider.config.credentialsin YAML, orGOOGLE_DOCS_CREDENTIALS, orGOOGLE_SLIDEFLOW_CREDENTIALS(fallback).
For production Shared Drive setup and service-account bootstrap commands, see Google Service Accounts & Shared Drives.
Template Design for Marker-Based Sections¶
Use explicit section markers in your document template:
Rules:
- Marker ids must be unique per document.
- Marker ids should match
presentation.slides[].idexactly. - Markers should be plain text (do not split token text with inline objects/chips).
Provider Config¶
provider:
type: "google_docs"
config:
credentials: "/path/to/service-account.json"
template_id: "<google_docs_template_id>"
document_folder_id: "<folder_for_output_docs>"
drive_folder_id: "<folder_for_chart_images>"
section_marker_prefix: "{{SECTION:"
section_marker_suffix: "}}"
remove_section_markers: false
default_chart_width_pt: 300
share_with:
- "team@example.com"
share_role: "reader"
transfer_ownership_to: "owner@example.com"
transfer_ownership_strict: false
chart_image_sharing_mode: "public" # public | restricted
requests_per_second: 1.0
strict_cleanup: false
Field behavior:
template_id: if set, SlideFlow copies the document template; otherwise creates a blank doc.document_folder_id: destination folder for generated docs.drive_folder_id: destination folder for uploaded chart images.section_marker_prefix/section_marker_suffix: marker token format.share_with/share_role: post-render sharing.transfer_ownership_to: optional ownership handoff target after successful render/share.transfer_ownership_strict: iftrue, ownership handoff failure fails the run.chart_image_sharing_mode: uploaded chart-image ACL mode:public(default): grantsanyone:readerbefore insertion.restricted: skips public ACL grant (tighter access; insertion compatibility depends on your Drive permissions model).requests_per_second: API pacing control.strict_cleanup: fail run if chart-image cleanup fails.
Current implementation notes:
remove_section_markersruns after render finalization and deletes section-marker tokens.default_chart_width_ptis currently reserved and not yet applied at render time.
Runtime Behavior¶
- Replacements are section-scoped by marker id.
- Charts are inserted inline at the matched section anchor.
- Positional chart fields (
x,y, alignment) are ignored forgoogle_docsand log a warning when non-zero positional values are provided. - The build result
urlpoints tohttps://docs.google.com/document/d/<id>. - Ownership transfer is explicit opt-in and only supported for files in My Drive (not Shared Drives).
For Shared Drive-first patterns and ownership-transfer constraints, see Google Service Accounts & Shared Drives.
Citation Rendering¶
When citations.enabled: true, Google Docs rendering supports two modes:
citations.location: per_section(orper_slide):- creates section-scoped footnotes with a
Sourcesblock. citations.location: document_end:- appends a deduplicated
Sourcessection to the document end.
Citation payloads are also included in build JSON output for downstream audit or notification workflows.
Contract Validation¶
Use provider contract checks before build:
Contract checks for google_docs validate:
- marker presence for each configured
slide.id - marker uniqueness
- placeholder presence within the section body
- template fetch accessibility
Issue types:
template_fetch_failedmissing_section_markerduplicate_section_markermissing_placeholder
Minimal Example¶
provider:
type: "google_docs"
config:
template_id: "1AbCdEf..."
presentation:
name: "Weekly Newsletter"
slides:
- id: "intro"
replacements:
- type: "text"
config:
placeholder: "{{WEEK_LABEL}}"
replacement: "Week 09"
Operational Notes¶
- Start with conservative concurrency/rate settings and tune gradually.
- Keep markers stable after config wiring.
- Validate with
--provider-contract-checkin CI for template safety. - Cleanup logs include deleted/failed chart-image totals and failed file IDs when applicable.
Related references: