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.

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"
}

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
  • 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 text
    • bold boolean (nullable): Whether content is bold
    • italic boolean (nullable): Whether content is italic
    • fontSize number (nullable): Font size in points

Returns:

  • documentId string: Created document ID
  • documentUrl string (nullable): Direct link to open in Google Docs

Example Usage:

{
  "title": "Q1 Report",
  "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.",
      "bold": false
    }
  ]
}

Content

Insert and modify content within existing documents.

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): Character index for insertion position (defaults to 1, the beginning)
  • 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

Returns:

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

Example Usage:

{
  "documentId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms",
  "text": "Important Note",
  "paragraphStyle": "HEADING_2",
  "bold": true,
  "fontSize": 14
}

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 header labels
  • rows array of arrays of strings (required): Table data rows
  • index number (nullable): Character index for insertion position (defaults to 1)

Returns:

  • documentId string: Document ID

Example Usage:

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

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