google-slides

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Slides

Google Slides

Interact with Google Slides for presentation creation, slide management, and content insertion.
通过本工具可与Google Slides交互,实现演示文稿创建、幻灯片管理及内容插入操作。

Installation

安装

  1. Install Python dependencies:
    bash
    pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml
  2. Download the skill from Releases or use directly from this repository.
  1. 安装Python依赖包:
    bash
    pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml
  2. 下载技能包:从Releases下载,或直接使用本仓库中的内容。

Setup Verification

安装验证

After installation, verify the skill is properly configured:
bash
python scripts/google-slides.py check
This will check:
  • Python dependencies (google-auth, google-auth-oauthlib, google-api-python-client, keyring, pyyaml)
  • Authentication configuration
  • Connectivity to Google Slides API
If anything is missing, the check command will provide setup instructions.
安装完成后,验证技能包是否配置正确:
bash
python scripts/google-slides.py check
该命令会检查以下内容:
  • Python依赖包(google-auth、google-auth-oauthlib、google-api-python-client、keyring、pyyaml)
  • 身份验证配置
  • 与Google Slides API的连接性
若有缺失项,检查命令会提供对应的设置说明。

Authentication

身份验证

Google Slides uses OAuth 2.0 for authentication. For complete setup instructions, see:
  1. GCP Project Setup Guide - Create project, enable Slides API
  2. Google OAuth Setup Guide - Configure credentials
Google Slides采用OAuth 2.0进行身份验证。完整设置说明请参考:
  1. GCP项目设置指南 - 创建项目、启用Slides API
  2. Google OAuth设置指南 - 配置凭证

Quick Start

快速开始

  1. Create
    ~/.config/agent-skills/google.yaml
    :
    yaml
    oauth_client:
      client_id: your-client-id.apps.googleusercontent.com
      client_secret: your-client-secret
  2. Run
    python scripts/google-slides.py check
    to trigger OAuth flow and verify setup.
  1. 创建
    ~/.config/agent-skills/google.yaml
    文件:
    yaml
    oauth_client:
      client_id: your-client-id.apps.googleusercontent.com
      client_secret: your-client-secret
  2. 运行
    python scripts/google-slides.py check
    触发OAuth流程并验证设置。

OAuth Scopes

OAuth权限范围

The skill requests granular scopes for different operations:
ScopePermissionUsed For
presentations.readonly
Read presentationsReading presentation metadata and content
presentations
Full accessCreating and modifying presentations
drive.readonly
Read Drive filesExporting presentations as PDF
本技能包针对不同操作请求精细化的权限范围:
权限范围权限说明适用场景
presentations.readonly
读取演示文稿读取演示文稿元数据和内容
presentations
完全访问权限创建和修改演示文稿
drive.readonly
读取云端硬盘文件将演示文稿导出为PDF格式

Scope Errors

权限范围错误

If you encounter "insufficient scope" errors, revoke your token and re-authenticate:
  1. Revoke at https://myaccount.google.com/permissions
  2. Clear token:
    keyring del agent-skills google-slides-token-json
  3. Re-run:
    python scripts/google-slides.py check
若遇到“权限不足”错误,请撤销现有令牌并重新进行身份验证:
  1. 访问https://myaccount.google.com/permissions撤销权限
  2. 清除令牌:
    keyring del agent-skills google-slides-token-json
  3. 重新运行:
    python scripts/google-slides.py check

Commands

命令说明

check

check

Verify configuration and connectivity.
bash
python scripts/google-slides.py check
This validates:
  • Python dependencies are installed
  • Authentication is configured
  • Can connect to Google Slides API
  • Creates a test presentation to verify write access
验证配置和连接性。
bash
python scripts/google-slides.py check
该命令会验证:
  • Python依赖包已安装
  • 身份验证已配置
  • 可连接到Google Slides API
  • 创建测试演示文稿以验证写入权限

auth setup

auth setup

Store OAuth 2.0 client credentials for custom OAuth flow.
bash
python scripts/google-slides.py auth setup \
  --client-id YOUR_CLIENT_ID \
  --client-secret YOUR_CLIENT_SECRET
Credentials are saved to
~/.config/agent-skills/google-slides.yaml
.
Options:
  • --client-id
    - OAuth 2.0 client ID (required)
  • --client-secret
    - OAuth 2.0 client secret (required)
存储OAuth 2.0客户端凭证,用于自定义OAuth流程。
bash
python scripts/google-slides.py auth setup \
  --client-id YOUR_CLIENT_ID \
  --client-secret YOUR_CLIENT_SECRET
凭证将保存到
~/.config/agent-skills/google-slides.yaml
文件中。
选项:
  • --client-id
    - OAuth 2.0客户端ID(必填)
  • --client-secret
    - OAuth 2.0客户端密钥(必填)

presentations create

presentations create

Create a new Google Slides presentation.
bash
python scripts/google-slides.py presentations create --title "My Presentation"
Options:
  • --title
    - Presentation title (required)
  • --json
    - Output as JSON
Example:
bash
python scripts/google-slides.py presentations create --title "Q4 Review"
创建新的Google Slides演示文稿。
bash
python scripts/google-slides.py presentations create --title "My Presentation"
选项:
  • --title
    - 演示文稿标题(必填)
  • --json
    - 以JSON格式输出结果
示例:
bash
python scripts/google-slides.py presentations create --title "Q4 Review"

Output:

输出:

✓ Presentation created successfully

✓ 演示文稿创建成功

Title: Q4 Review

标题: Q4 Review

Presentation ID: 1abc...xyz

演示文稿ID: 1abc...xyz

Slides: 1

幻灯片数量: 1

undefined
undefined

presentations get

presentations get

Get presentation metadata and structure.
bash
python scripts/google-slides.py presentations get PRESENTATION_ID
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --json
    - Output full presentation structure as JSON
Example:
bash
python scripts/google-slides.py presentations get 1abc...xyz
获取演示文稿的元数据和结构。
bash
python scripts/google-slides.py presentations get PRESENTATION_ID
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --json
    - 以JSON格式输出完整的演示文稿结构
示例:
bash
python scripts/google-slides.py presentations get 1abc...xyz

Output:

输出:

Title: Q4 Review

标题: Q4 Review

Presentation ID: 1abc...xyz

演示文稿ID: 1abc...xyz

Slides: 5

幻灯片数量: 5

Slides:

幻灯片列表:

Slide 1:

幻灯片1:

ID: slide_id_1

ID: slide_id_1

Layout: TITLE

布局: TITLE

Elements: 2 (2 text, 0 shapes, 0 images, 0 other)

元素: 2个(2个文本、0个形状、0个图片、0个其他元素)

Slide 2:

幻灯片2:

ID: slide_id_2

ID: slide_id_2

Layout: TITLE_AND_BODY

布局: TITLE_AND_BODY

Elements: 3 (2 text, 1 shapes, 0 images, 0 other)

元素: 3个(2个文本、1个形状、0个图片、0个其他元素)

undefined
undefined

presentations read

presentations read

Read presentation text content from all slides, or export as PDF.
bash
python scripts/google-slides.py presentations read PRESENTATION_ID
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --format
    - Output format:
    text
    (default) or
    pdf
  • --output
    ,
    -o
    - Output file path (used with pdf format)
  • --json
    - Output as JSON with content field (for text format)
Example:
bash
undefined
读取所有幻灯片的文本内容,或导出为PDF格式。
bash
python scripts/google-slides.py presentations read PRESENTATION_ID
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --format
    - 输出格式:
    text
    (默认)或
    pdf
  • --output
    ,
    -o
    - 输出文件路径(仅在pdf格式下使用)
  • --json
    - 以JSON格式输出内容字段(仅在text格式下使用)
示例:
bash
undefined

Read as text (default)

以文本格式读取(默认)

python scripts/google-slides.py presentations read 1abc...xyz
python scripts/google-slides.py presentations read 1abc...xyz

Export as PDF

导出为PDF格式

python scripts/google-slides.py presentations read 1abc...xyz --format pdf --output presentation.pdf
python scripts/google-slides.py presentations read 1abc...xyz --format pdf --output presentation.pdf

Output (text format):

输出(文本格式):

--- Slide 1 ---

--- 幻灯片1 ---

Welcome to Our Product

欢迎了解我们的产品

An introduction to key features

核心功能介绍

--- Slide 2 ---

--- 幻灯片2 ---

Key Metrics

关键指标

Revenue: $1.2M

营收: $1.2M

Users: 50,000

用户数: 50,000

--- Slide 3 ---

--- 幻灯片3 ---

| Quarter | Revenue | Growth |

| 季度 | 营收 | 增长率 |

| --- | --- | --- |

| --- | --- | --- |

| Q1 | $250K | 10% |

| Q1 | $250K | 10% |

| Q2 | $300K | 20% |

| Q2 | $300K | 20% |


**Note:** Text format extracts text from all shapes, text boxes, and tables on each slide (tables formatted as markdown). PDF export uses Google's native Drive API export, which requires the `drive.readonly` scope.

**注意:** 文本格式会提取每张幻灯片上所有形状、文本框和表格中的文本(表格会转换为Markdown格式)。PDF导出使用Google原生云端硬盘API,需要`drive.readonly`权限范围。

slides create

slides create

Add a new slide to a presentation.
bash
python scripts/google-slides.py slides create PRESENTATION_ID --layout BLANK
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --layout
    - Slide layout (default: BLANK)
    • BLANK
      - Empty slide
    • TITLE
      - Title slide
    • TITLE_AND_BODY
      - Title and body text
    • TITLE_ONLY
      - Title only
    • SECTION_HEADER
      - Section header
    • SECTION_TITLE_AND_DESCRIPTION
      - Section with description
    • ONE_COLUMN_TEXT
      - Single column of text
    • MAIN_POINT
      - Large centered text
    • BIG_NUMBER
      - Large number display
  • --index
    - Insert at specific position (0-based, optional)
  • --json
    - Output API response as JSON
Example:
bash
undefined
向演示文稿中添加新幻灯片。
bash
python scripts/google-slides.py slides create PRESENTATION_ID --layout BLANK
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --layout
    - 幻灯片布局(默认: BLANK)
    • BLANK
      - 空白幻灯片
    • TITLE
      - 标题幻灯片
    • TITLE_AND_BODY
      - 标题与正文
    • TITLE_ONLY
      - 仅标题
    • SECTION_HEADER
      - 章节标题
    • SECTION_TITLE_AND_DESCRIPTION
      - 章节标题与描述
    • ONE_COLUMN_TEXT
      - 单列文本
    • MAIN_POINT
      - 居中大文本
    • BIG_NUMBER
      - 大数字展示
  • --index
    - 插入到指定位置(从0开始计数,可选)
  • --json
    - 以JSON格式输出API响应
示例:
bash
undefined

Add blank slide at the end

在末尾添加空白幻灯片

python scripts/google-slides.py slides create 1abc...xyz --layout BLANK
python scripts/google-slides.py slides create 1abc...xyz --layout BLANK

Add title slide at position 0

在位置0添加标题幻灯片

python scripts/google-slides.py slides create 1abc...xyz --layout TITLE --index 0
python scripts/google-slides.py slides create 1abc...xyz --layout TITLE --index 0

Output:

输出:

✓ Slide created successfully

✓ 幻灯片创建成功

Slide ID: slide_abc123

幻灯片ID: slide_abc123

Layout: TITLE

布局: TITLE


See [references/layouts-guide.md](references/layouts-guide.md) for layout details.

布局详情请参考[references/layouts-guide.md](references/layouts-guide.md)。

slides delete

slides delete

Delete a slide from a presentation.
bash
python scripts/google-slides.py slides delete PRESENTATION_ID --slide-id SLIDE_ID
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --slide-id
    - Slide object ID to delete (required, not the index!)
  • --json
    - Output API response as JSON
Example:
bash
undefined
从演示文稿中删除幻灯片。
bash
python scripts/google-slides.py slides delete PRESENTATION_ID --slide-id SLIDE_ID
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --slide-id
    - 要删除的幻灯片对象ID(必填,不是索引!)
  • --json
    - 以JSON格式输出API响应
示例:
bash
undefined

Get slide IDs first

先获取幻灯片ID

python scripts/google-slides.py presentations get 1abc...xyz --json | jq '.slides[].objectId'
python scripts/google-slides.py presentations get 1abc...xyz --json | jq '.slides[].objectId'

Delete a slide

删除幻灯片

python scripts/google-slides.py slides delete 1abc...xyz --slide-id slide_abc123
python scripts/google-slides.py slides delete 1abc...xyz --slide-id slide_abc123

Output:

输出:

✓ Slide deleted successfully

✓ 幻灯片删除成功


**Warning:** Cannot delete the last remaining slide in a presentation.

**警告:** 无法删除演示文稿中最后一张剩余的幻灯片。

text insert

text insert

Insert text into a slide.
bash
python scripts/google-slides.py text insert PRESENTATION_ID \
  --slide-id SLIDE_ID \
  --text "Hello World"
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --slide-id
    - Slide object ID (required)
  • --text
    - Text to insert (required)
  • --x
    - X position in points (default: 100)
  • --y
    - Y position in points (default: 100)
  • --width
    - Text box width in points (default: 400)
  • --height
    - Text box height in points (default: 100)
  • --json
    - Output API response as JSON
Example:
bash
undefined
在幻灯片中插入文本。
bash
python scripts/google-slides.py text insert PRESENTATION_ID \
  --slide-id SLIDE_ID \
  --text "Hello World"
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --slide-id
    - 幻灯片对象ID(必填)
  • --text
    - 要插入的文本(必填)
  • --x
    - X轴位置(单位:磅,默认: 100)
  • --y
    - Y轴位置(单位:磅,默认: 100)
  • --width
    - 文本框宽度(单位:磅,默认: 400)
  • --height
    - 文本框高度(单位:磅,默认: 100)
  • --json
    - 以JSON格式输出API响应
示例:
bash
undefined

Insert text at default position

在默认位置插入文本

python scripts/google-slides.py text insert 1abc...xyz
--slide-id slide_abc123
--text "Hello World"
python scripts/google-slides.py text insert 1abc...xyz
--slide-id slide_abc123
--text "Hello World"

Insert text at custom position

在自定义位置插入文本

python scripts/google-slides.py text insert 1abc...xyz
--slide-id slide_abc123
--text "Q4 Results"
--x 50 --y 50 --width 500 --height 80
python scripts/google-slides.py text insert 1abc...xyz
--slide-id slide_abc123
--text "Q4 Results"
--x 50 --y 50 --width 500 --height 80

Output:

输出:

✓ Text inserted successfully

✓ 文本插入成功

Text: Q4 Results

文本内容: Q4 Results

Position: (50.0, 50.0) points

位置: (50.0, 50.0) 磅

Size: 500.0 x 80.0 points

尺寸: 500.0 x 80.0 磅


**Note:** Coordinates are in points (1 point = 1/72 inch). Origin (0,0) is top-left.

**注意:** 坐标单位为磅(1磅 = 1/72英寸)。原点(0,0)位于幻灯片左上角。

shapes create

shapes create

Create a shape on a slide.
bash
python scripts/google-slides.py shapes create PRESENTATION_ID \
  --slide-id SLIDE_ID \
  --shape-type RECTANGLE
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --slide-id
    - Slide object ID (required)
  • --shape-type
    - Shape type (required)
    • RECTANGLE
      ,
      ELLIPSE
      ,
      TRIANGLE
      ,
      PENTAGON
      ,
      HEXAGON
    • STAR_5
      ,
      STAR_8
      ,
      STAR_24
      ,
      STAR_32
    • CLOUD
      ,
      HEART
      ,
      LIGHTNING_BOLT
      ,
      MOON
      ,
      SUN
    • ARROW_NORTH
      ,
      ARROW_EAST
      ,
      ARROW_SOUTH
      ,
      ARROW_WEST
    • And many more (see references/shapes-guide.md)
  • --x
    - X position in points (default: 100)
  • --y
    - Y position in points (default: 100)
  • --width
    - Shape width in points (default: 200)
  • --height
    - Shape height in points (default: 200)
  • --json
    - Output API response as JSON
Example:
bash
undefined
在幻灯片中创建形状。
bash
python scripts/google-slides.py shapes create PRESENTATION_ID \
  --slide-id SLIDE_ID \
  --shape-type RECTANGLE
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --slide-id
    - 幻灯片对象ID(必填)
  • --shape-type
    - 形状类型(必填)
    • RECTANGLE
      ,
      ELLIPSE
      ,
      TRIANGLE
      ,
      PENTAGON
      ,
      HEXAGON
    • STAR_5
      ,
      STAR_8
      ,
      STAR_24
      ,
      STAR_32
    • CLOUD
      ,
      HEART
      ,
      LIGHTNING_BOLT
      ,
      MOON
      ,
      SUN
    • ARROW_NORTH
      ,
      ARROW_EAST
      ,
      ARROW_SOUTH
      ,
      ARROW_WEST
    • 更多形状类型请参考references/shapes-guide.md
  • --x
    - X轴位置(单位:磅,默认: 100)
  • --y
    - Y轴位置(单位:磅,默认: 100)
  • --width
    - 形状宽度(单位:磅,默认: 200)
  • --height
    - 形状高度(单位:磅,默认: 200)
  • --json
    - 以JSON格式输出API响应
示例:
bash
undefined

Create rectangle

创建矩形

python scripts/google-slides.py shapes create 1abc...xyz
--slide-id slide_abc123
--shape-type RECTANGLE
python scripts/google-slides.py shapes create 1abc...xyz
--slide-id slide_abc123
--shape-type RECTANGLE

Create star with custom size

创建自定义尺寸的星形

python scripts/google-slides.py shapes create 1abc...xyz
--slide-id slide_abc123
--shape-type STAR_5
--x 300 --y 200 --width 150 --height 150
python scripts/google-slides.py shapes create 1abc...xyz
--slide-id slide_abc123
--shape-type STAR_5
--x 300 --y 200 --width 150 --height 150

Output:

输出:

✓ Shape created successfully

✓ 形状创建成功

Type: STAR_5

类型: STAR_5

Position: (300.0, 200.0) points

位置: (300.0, 200.0) 磅

Size: 150.0 x 150.0 points

尺寸: 150.0 x 150.0 磅


See [references/shapes-guide.md](references/shapes-guide.md) for all shape types.

所有形状类型请参考[references/shapes-guide.md](references/shapes-guide.md)。

images create

images create

Insert an image into a slide.
bash
python scripts/google-slides.py images create PRESENTATION_ID \
  --slide-id SLIDE_ID \
  --image-url "https://example.com/image.png"
Arguments:
  • presentation_id
    - The Google Slides presentation ID
Options:
  • --slide-id
    - Slide object ID (required)
  • --image-url
    - Image URL (required, must be publicly accessible)
  • --x
    - X position in points (default: 100)
  • --y
    - Y position in points (default: 100)
  • --width
    - Image width in points (default: 300)
  • --height
    - Image height in points (default: 200)
  • --json
    - Output API response as JSON
Example:
bash
python scripts/google-slides.py images create 1abc...xyz \
  --slide-id slide_abc123 \
  --image-url "https://example.com/chart.png" \
  --x 50 --y 150 --width 400 --height 300
在幻灯片中插入图片。
bash
python scripts/google-slides.py images create PRESENTATION_ID \
  --slide-id SLIDE_ID \
  --image-url "https://example.com/image.png"
参数:
  • presentation_id
    - Google Slides演示文稿ID
选项:
  • --slide-id
    - 幻灯片对象ID(必填)
  • --image-url
    - 图片URL(必填,必须可公开访问)
  • --x
    - X轴位置(单位:磅,默认: 100)
  • --y
    - Y轴位置(单位:磅,默认: 100)
  • --width
    - 图片宽度(单位:磅,默认: 300)
  • --height
    - 图片高度(单位:磅,默认: 200)
  • --json
    - 以JSON格式输出API响应
示例:
bash
python scripts/google-slides.py images create 1abc...xyz \
  --slide-id slide_abc123 \
  --image-url "https://example.com/chart.png" \
  --x 50 --y 150 --width 400 --height 300

Output:

输出:

✓ Image created successfully

✓ 图片插入成功

Position: (50.0, 150.0) points

位置: (50.0, 150.0) 磅

Size: 400.0 x 300.0 points

尺寸: 400.0 x 300.0 磅


**Note:** The image URL must be publicly accessible or authenticated with Google.

**注意:** 图片URL必须可公开访问,或已通过Google身份验证。

Examples

使用示例

Create a simple presentation

创建简单演示文稿

bash
undefined
bash
undefined

Create presentation

创建演示文稿

PRES_ID=$(python scripts/google-slides.py presentations create
--title "Team Update" --json | jq -r '.presentationId')
PRES_ID=$(python scripts/google-slides.py presentations create
--title "Team Update" --json | jq -r '.presentationId')

Get the default slide ID

获取默认幻灯片ID

SLIDE_ID=$(python scripts/google-slides.py presentations get $PRES_ID --json |
jq -r '.slides[0].objectId')
SLIDE_ID=$(python scripts/google-slides.py presentations get $PRES_ID --json |
jq -r '.slides[0].objectId')

Add title text

添加标题文本

python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "Q4 Team Update"
--x 50 --y 50 --width 600 --height 100
python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "Q4团队更新"
--x 50 --y 50 --width 600 --height 100

Add subtitle

添加副标题

python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "December 2024"
--x 50 --y 180 --width 600 --height 50
undefined
python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "2024年12月"
--x 50 --y 180 --width 600 --height 50
undefined

Build a multi-slide presentation

创建多幻灯片演示文稿

bash
#!/bin/bash
PRES_ID="your-presentation-id"
bash
#!/bin/bash
PRES_ID="your-presentation-id"

Add content slide

添加内容幻灯片

SLIDE_ID=$(python scripts/google-slides.py slides create $PRES_ID
--layout TITLE_AND_BODY --json | jq -r '.replies[0].createSlide.objectId')
SLIDE_ID=$(python scripts/google-slides.py slides create $PRES_ID
--layout TITLE_AND_BODY --json | jq -r '.replies[0].createSlide.objectId')

Add title

添加标题

python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "Key Metrics"
--x 50 --y 30 --width 600 --height 60
python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "关键指标"
--x 50 --y 30 --width 600 --height 60

Add chart image

添加图表图片

python scripts/google-slides.py images create $PRES_ID
--slide-id $SLIDE_ID
--image-url "https://example.com/metrics.png"
--x 100 --y 120 --width 500 --height 350
python scripts/google-slides.py images create $PRES_ID
--slide-id $SLIDE_ID
--image-url "https://example.com/metrics.png"
--x 100 --y 120 --width 500 --height 350

Add another slide with shapes

添加带形状的另一张幻灯片

SLIDE2_ID=$(python scripts/google-slides.py slides create $PRES_ID
--layout BLANK --json | jq -r '.replies[0].createSlide.objectId')
SLIDE2_ID=$(python scripts/google-slides.py slides create $PRES_ID
--layout BLANK --json | jq -r '.replies[0].createSlide.objectId')

Add decorative shape

添加装饰性星形

python scripts/google-slides.py shapes create $PRES_ID
--slide-id $SLIDE2_ID
--shape-type STAR_5
--x 550 --y 30 --width 80 --height 80
undefined
python scripts/google-slides.py shapes create $PRES_ID
--slide-id $SLIDE2_ID
--shape-type STAR_5
--x 550 --y 30 --width 80 --height 80
undefined

Create presentation from data

基于数据创建演示文稿

bash
#!/bin/bash
bash
#!/bin/bash

Create presentation

创建演示文稿

PRES_ID=$(python scripts/google-slides.py presentations create
--title "Sales Report" --json | jq -r '.presentationId')
PRES_ID=$(python scripts/google-slides.py presentations create
--title "销售报告" --json | jq -r '.presentationId')

Add slide for each region

为每个区域添加幻灯片

for region in "North" "South" "East" "West"; do SLIDE_ID=$(python scripts/google-slides.py slides create $PRES_ID
--layout TITLE_AND_BODY --json | jq -r '.replies[0].createSlide.objectId')
python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "$region Region Sales"
--x 50 --y 30 --width 600 --height 80 done
undefined
for region in "北部" "南部" "东部" "西部"; do SLIDE_ID=$(python scripts/google-slides.py slides create $PRES_ID
--layout TITLE_AND_BODY --json | jq -r '.replies[0].createSlide.objectId')
python scripts/google-slides.py text insert $PRES_ID
--slide-id $SLIDE_ID
--text "$region区域销售情况"
--x 50 --y 30 --width 600 --height 80 done
undefined

Coordinate System

坐标系统

Google Slides uses points for positioning and sizing:
  • 1 point = 1/72 inch
  • 1 inch = 72 points
  • Origin (0, 0) is at the top-left corner
  • Standard slide size: 720 x 540 points (10 x 7.5 inches)
Common reference positions:
(0, 0)                                    (720, 0)
  ┌───────────────────────────────────────┐
  │  Title area                           │
  │  (50, 50, 620, 80)                    │
  │                                       │
  │  Content area                         │
  │  (50, 150, 620, 350)                  │
  │                                       │
  │                                       │
  └───────────────────────────────────────┘
(0, 540)                                (720, 540)
Google Slides使用作为位置和尺寸的单位:
  • 1磅 = 1/72英寸
  • 1英寸 = 72磅
  • 原点(0, 0)位于幻灯片左上角
  • 标准幻灯片尺寸:720 x 540磅(10 x 7.5英寸)
常用参考位置:
(0, 0)                                    (720, 0)
  ┌───────────────────────────────────────┐
  │  标题区域                           │
  │  (50, 50, 620, 80)                    │
  │                                       │
  │  内容区域                           │
  │  (50, 150, 620, 350)                  │
  │                                       │
  │                                       │
  └───────────────────────────────────────┘
(0, 540)                                (720, 540)

Troubleshooting

故障排除

"Insufficient scope" errors

“权限不足”错误

You need to revoke and re-authenticate to grant additional permissions:
  1. Go to https://myaccount.google.com/permissions
  2. Find "Agent Skills" and remove access
  3. Delete stored token:
    keyring del agent-skills google-slides-token-json
  4. Run
    python scripts/google-slides.py check
    to re-authenticate
需要撤销现有权限并重新验证以获取额外权限:
  1. 访问https://myaccount.google.com/permissions
  2. 找到“Agent Skills”并移除访问权限
  3. 删除存储的令牌:
    keyring del agent-skills google-slides-token-json
  4. 运行
    python scripts/google-slides.py check
    重新进行身份验证

Cannot find presentation

无法找到演示文稿

Make sure you're using the correct presentation ID from the URL:
  • URL:
    https://docs.google.com/presentation/d/1abc...xyz/edit
  • Presentation ID:
    1abc...xyz
确保使用的是URL中的正确演示文稿ID:
  • URL:
    https://docs.google.com/presentation/d/1abc...xyz/edit
  • 演示文稿ID:
    1abc...xyz

Cannot find slide ID

无法找到幻灯片ID

Slide IDs are object IDs, not indices. Get them with:
bash
python scripts/google-slides.py presentations get $PRES_ID --json | \
  jq -r '.slides[] | "\(.objectId) (index \(.slideProperties.slideIndex))"'
幻灯片ID是对象ID,不是索引。可通过以下命令获取:
bash
python scripts/google-slides.py presentations get $PRES_ID --json | \
  jq -r '.slides[] | "\(.objectId) (索引 \(.slideProperties.slideIndex))"'

Image not appearing

图片无法显示

The image URL must be:
  • Publicly accessible (no authentication required), OR
  • Accessible to the Google account you're using
Test the URL in a browser. If it requires authentication, you'll need to:
  1. Upload the image to Google Drive
  2. Make it publicly accessible or share it with your Google account
  3. Use the Google Drive URL
图片URL必须满足以下条件之一:
  • 可公开访问(无需身份验证),或
  • 可被当前使用的Google账户访问
可在浏览器中测试URL。若需要身份验证,请执行以下步骤:
  1. 将图片上传到Google云端硬盘
  2. 设置为公开访问或与当前Google账户共享
  3. 使用Google云端硬盘URL

Slide position/size issues

幻灯片位置/尺寸问题

Remember:
  • Coordinates are in points, not pixels
  • Standard slide: 720 x 540 points
  • Elements outside slide boundaries won't be visible
  • Use
    --x
    ,
    --y
    ,
    --width
    ,
    --height
    to position elements
请记住:
  • 坐标单位为,而非像素
  • 标准幻灯片尺寸为720 x 540磅
  • 超出幻灯片边界的元素将不可见
  • 使用
    --x
    ,
    --y
    ,
    --width
    ,
    --height
    参数调整元素位置和尺寸

Dependencies not found

依赖包未找到

Install required dependencies:
bash
pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml
安装所需依赖包:
bash
pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml

OAuth flow fails

OAuth流程失败

Ensure your GCP project has:
  1. Google Slides API enabled (
    slides.googleapis.com
    )
  2. OAuth 2.0 credentials created
  3. OAuth consent screen configured
  4. Your email added as a test user (if app is in testing mode)
See docs/gcp-project-setup.md for detailed instructions.
确保你的GCP项目已完成以下设置:
  1. 已启用Google Slides API (
    slides.googleapis.com
    )
  2. 已创建OAuth 2.0凭证
  3. 已配置OAuth同意屏幕
  4. 若应用处于测试模式,已将你的邮箱添加为测试用户
详细说明请参考docs/gcp-project-setup.md

Related Skills

相关技能

  • Google Drive - File management (Drive manages file metadata, Slides manages content)
  • Google Docs - Document creation and editing
  • Google Sheets - Spreadsheet management
  • Google Drive - 文件管理(云端硬盘管理文件元数据,Slides管理内容)
  • Google Docs - 文档创建与编辑
  • Google Sheets - 电子表格管理

API Reference

API参考

For advanced usage, see:
如需高级用法,请参考: