Logo

Google Docs

Authentication Type: OAuth Description: Create and edit Google Docs documents programmatically, including inserting formatted text, tables, and building structured documents with headings and sections.


Authentication

To authenticate with Google Docs, you need OAuth2 credentials with Docs access scopes. This uses the same Google Workspace OAuth connection.


Documents

Create and retrieve Google Docs documents.

Create Document In Folder

Create a new Google Doc and place it inside a specified Google Drive folder.

Operation Type: Mutation (Write)

Parameters:

  • title string (required): Title for the new document
  • folderId string (required): ID of the Google Drive folder to place the new document in

Returns:

  • documentId string: Document ID
  • documentUrl string (nullable): Document URL
  • parents array of strings (nullable): Parent folder IDs after the move

Example Usage:

{
  "title": "Q1 Report",
  "folderId": "1a2b3c4d5e6f7g8h9i0j"
}

Create Structured Document

Create a new Google Docs document with structured sections, headings, and formatted text in a single operation.

Operation Type: Mutation (Write)

Parameters:

  • title string (required): Document title
  • fontFamily string (nullable): Font family to apply to the entire document (e.g. Inter, Roboto, Georgia). Defaults to Google Docs default.
  • sections array (required): Array of document sections
    • heading string (nullable): Section heading text
    • headingLevel number (nullable): Heading level (1-6)
    • content string (required): Section content (supports markdown: bold, italic, links, - bullets, 1. numbered lists, > quotes, --- horizontal rules)

Returns:

  • documentId string: Created document ID
  • documentUrl string (nullable): Always null (Google Docs API doesn't return the document URL directly)

Example Usage:

{
  "title": "Q1 Report",
  "fontFamily": "Inter",
  "sections": [
    {
      "heading": "Executive Summary",
      "headingLevel": 1,
      "content": "This quarter saw **significant growth** across all metrics."
    },
    {
      "heading": "Revenue",
      "headingLevel": 2,
      "content": "Revenue increased 25% year-over-year."
    }
  ]
}

Get Document

Retrieve the contents and metadata of a Google Docs document.

Operation Type: Query (Read)

Parameters:

  • documentId string (required): The document ID from the Google Docs URL

Returns:

  • documentId string: Document ID
  • title string: Document title
  • body object (nullable): Document body
    • content array (nullable): Document content elements
  • revisionId string (nullable): Current revision ID

Example Usage:

{
  "documentId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms"
}

Content

Insert and modify content within existing documents.

Insert Table

Insert a table with headers and data rows into an existing document.

Operation Type: Mutation (Write)

Parameters:

  • documentId string (required): Document ID
  • headers array of strings (required): Column headers for the table
  • rows array of arrays of strings (required): Table data rows (each row must have same number of columns as headers)
  • index number (nullable): The index at which to insert the table (defaults to end of document)
  • fontFamily string (nullable): Font family to apply to the table (e.g. Inter, Roboto, Georgia)

Returns:

  • documentId string: Document ID

Example Usage:

{
  "documentId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms",
  "headers": ["Name", "Role", "Department"],
  "rows": [
    ["Alice", "Engineer", "Engineering"],
    ["Bob", "Designer", "Product"]
  ],
  "fontFamily": "Inter"
}

Insert Text with Formatting

Insert formatted text into an existing document at a specific position with optional styling.

Operation Type: Mutation (Write)

Parameters:

  • documentId string (required): Document ID
  • text string (required): Text to insert
  • index number (nullable): The index at which to insert (defaults to end of document)
  • paragraphStyle string (nullable): Paragraph style. Options: "NORMAL_TEXT", "TITLE", "SUBTITLE", "HEADING_1" through "HEADING_6"
  • bold boolean (nullable): Apply bold formatting
  • italic boolean (nullable): Apply italic formatting
  • underline boolean (nullable): Apply underline formatting
  • fontSize number (nullable): Font size in points
  • fontFamily string (nullable): Font family to apply (e.g. Inter, Roboto, Georgia)
  • markdown boolean (nullable): When true, parse text as markdown (supports bold, italic, links, lists, tables, code blocks, etc.). Other formatting fields are ignored when markdown is enabled.

Returns:

  • documentId string: Document ID
  • replies array (nullable): Batch update replies

Example Usage:

{
  "documentId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms",
  "text": "## Important Note\n\nThis is **bold** and *italic* text.",
  "markdown": true,
  "fontFamily": "Inter"
}

Common Use Cases

Document Generation:

  • Auto-generate reports from data pipelines with structured sections and tables
  • Create templated documents for proposals, invoices, or meeting notes
  • Build formatted documents from CRM data or form submissions

Content Management:

  • Insert dynamic content into existing templates
  • Add data tables from spreadsheets or databases into documents
  • Update document sections programmatically as data changes

Workflow Automation:

  • Generate onboarding documents for new employees with personalized content
  • Create project briefs and status reports automatically
  • Build document archives from structured data sources