Google Slides

Google Slides API integration with managed OAuth. Create presentations, add slides, insert

Google Slides is a community skill for presentation creation and automation, covering slide generation, content insertion, layout management, formatting control, and collaborative editing for programmatic presentation building.

What Is This?

Overview

Google Slides provides programmatic access to Google's presentation software for creating and editing presentations through API calls. It covers slide generation that creates new presentations and adds slides with predefined layouts and templates, content insertion that adds text boxes, images, shapes, tables, and charts to slides programmatically, layout management that applies master slide templates and arranges elements with precise positioning, formatting control that sets fonts, colors, sizes, and styles for text and visual elements, and collaborative editing that shares presentations with team members and manages permission levels. The skill enables developers to automate presentation creation for reporting, marketing materials, and data visualization without manual slide editing.

Who Should Use This

This skill serves data analysts generating automated reports with visualizations, marketing teams creating presentation materials at scale, and developers building document generation pipelines.

Why Use It?

Problems It Solves

Creating presentations manually for recurring reports is repetitive and time-consuming when the structure remains consistent. Updating presentations with current data requires manual copy-paste operations that are error-prone and difficult to scale. Maintaining consistent branding and formatting across many presentations becomes challenging without automation and templates. Generating personalized presentations for multiple clients or stakeholders requires duplicating effort and manual customization for each recipient.

Core Highlights

Slide generator creates presentations and adds slides with templates. Content inserter adds text, images, charts, and tables programmatically. Layout manager positions elements and applies master templates. Format controller sets fonts, colors, and visual styles across slides.

How to Use It?

Basic Usage

from googleapiclient.discovery import build
import os

creds = get_credentials()
service = build(
    'slides', 'v1', credentials=creds
)

presentation = service.presentations().create(
    body={'title': 'Q1 Report'}
).execute()

presentation_id = presentation['presentationId']

requests = [{
    'createSlide': {
        'slideLayoutReference': {
            'predefinedLayout': 'TITLE_AND_BODY'
        }
    }
}]

service.presentations().batchUpdate(
    presentationId=presentation_id,
    body={'requests': requests}
).execute()

Real-World Examples

slide_id = 'slide_001'

requests = [
    {
        'createShape': {
            'objectId': 'text_box_1',
            'shapeType': 'TEXT_BOX',
            'elementProperties': {
                'pageObjectId': slide_id,
                'size': {
                    'width': {'magnitude': 300, 'unit': 'PT'},
                    'height': {'magnitude': 50, 'unit': 'PT'}
                },
                'transform': {
                    'scaleX': 1,
                    'scaleY': 1,
                    'translateX': 100,
                    'translateY': 100,
                    'unit': 'PT'
                }
            }
        }
    },
    {
        'insertText': {
            'objectId': 'text_box_1',
            'text': 'Revenue Growth: 25%'
        }
    },
    {
        'createImage': {
            'url': 'https://example.com/chart.png',
            'elementProperties': {
                'pageObjectId': slide_id,
                'size': {
                    'width': {'magnitude': 400, 'unit': 'PT'},
                    'height': {'magnitude': 300, 'unit': 'PT'}
                },
                'transform': {
                    'translateX': 100,
                    'translateY': 200,
                    'unit': 'PT'
                }
            }
        }
    }
]

service.presentations().batchUpdate(
    presentationId=presentation_id,
    body={'requests': requests}
).execute()

Advanced Tips

Use batch update requests to perform multiple operations in a single API call for better performance and atomicity. Create presentation templates with placeholder elements that can be replaced programmatically with dynamic content. Export presentations to PDF or PowerPoint formats using the Google Drive API for distribution to stakeholders who need offline access.

When to Use It?

Use Cases

Generate weekly sales reports with charts and tables automatically populated from database queries and analytics platforms. Create personalized pitch decks for each prospect with customized content based on their industry and company data. Build a presentation generator that transforms markdown documents into formatted slides with consistent branding and layouts.

Related Topics

Presentation automation, document generation, Google Workspace APIs, data visualization, reporting automation, and template-based content creation.

Important Notes

Requirements

Google Workspace account with Google Slides enabled and API access configured through Google Cloud Console. OAuth credentials for authenticating API requests with appropriate scopes for reading and writing presentations. Understanding of the presentation object model including slides, shapes, and positioning units for effective automation.

Usage Recommendations

Do: use batch update operations to minimize API calls and ensure atomic updates to presentations for consistency. Create reusable presentation templates with master slides and layouts that can be applied programmatically across multiple presentations. Test positioning and sizing calculations thoroughly since coordinate systems can be confusing with different unit types.

Don't: make individual API calls for each element when adding multiple items to a slide since this is inefficient and slow. Ignore API rate limits which can cause request failures during high-volume operations requiring proper throttling. Hard-code positioning values without considering different screen sizes and aspect ratios for responsive layouts.

Limitations

Complex animations and transitions available in the Google Slides UI may not be fully supported through the API with limited programmatic control. Large presentations with many high-resolution images may hit API payload size limits requiring content optimization. Some advanced formatting options and effects available in the UI lack API equivalents for programmatic control.