A Python library to generate Google Slides from templates using AI-generated text and graphs
Project description
Slidio : The Google Slides Python Client
A Python library to dynamically generate Google Slides from templates using text, charts, and tables.
🚀 Features
- 🔤 Replace text in placeholder text boxes using
update_text(text_id, text_value) - 📊 Insert matplotlib figures in place of text boxes using
insert_graph(text_id, matplotlib_figure) - 📋 Insert tables using
insert_table(text_id, data) - 🪄 Designed for templating: works with alt-text-based placeholders (e.g.
{{ TITLE }},{{ BODY1 }}) - 📄 Create new presentations from templates with
from_template() - 👥 Share presentations with viewers and contributors
- 🔗 Get presentation URL with
urlproperty
🔧 Setup
- Enable Google Slides API and Google Drive API on Google Cloud
- Create a service account, download the
credentials.json - Share your template Google Slides file with the service account
🧱 Usage
Basic Usage
from py_slidio import SlidioClient
from google.oauth2 import service_account
import matplotlib.pyplot as plt
# Setup credentials and client
creds = service_account.Credentials.from_service_account_file(
"credentials.json",
scopes=[
"https://www.googleapis.com/auth/presentations",
"https://www.googleapis.com/auth/drive"
]
)
client = SlidioClient(creds, "your-presentation-id")
# Replace text
client.text.update_text("TITLE", "Quarterly Results")
# Insert graph
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 6, 5])
client.graph.insert_graph("BODY1", fig)
# Insert table
data = [
["Name", "Score"],
["John", "85"],
["Jane", "92"]
]
client.table.insert_table("TABLE1", data)
Creating from Template
# Create a new presentation from a template
client = SlidioClient.from_template(
credentials=creds,
template_id="template-presentation-id",
new_title="My New Presentation",
viewers_emails=["viewer@example.com"],
contributors_emails=["editor@example.com"]
)
# Get the presentation URL
print(f"Presentation URL: {client.url}")
📦 Installation
Installation du package
pip install -e .
Installation de l'environnement de développement
- Installer uv (si ce n'est pas déjà fait) :
pip install uv
- Installer les dépendances de développement :
uv pip install -e ".[dev]"
- Installer pre-commit :
pip install pre-commit
pre-commit install
- Installer les hooks Git :
pre-commit install
🛠️ Développement
Exécuter les tests
pytest
Vérifier le code
ruff check .
ruff format .
Vérifier les types
mypy .
📁 Directory Structure
py_slidio/
├── __init__.py
├── client.py
├── components/
│ ├── __init__.py
│ ├── text.py
│ ├── graph.py
│ └── table.py
└── utils.py
💡 Placeholder Design
Use {{ PLACEHOLDER_ID }} as the alt text in your Google Slides text boxes.
For example:
{{ TITLE }}for the presentation title{{ BODY1 }}for the first body text{{ GRAPH1 }}for the first graph{{ TABLE1 }}for the first table
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slidio-1.0.0.tar.gz.
File metadata
- Download URL: slidio-1.0.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42ca02412077fe507b18e40ed584d0c0bc3e29a61690fa098f101105cb505c7f
|
|
| MD5 |
d5dd0f94007ea60a5dee5ec45b39d950
|
|
| BLAKE2b-256 |
4ea7ca3f17e200f82e42ce8a2dd1d364d611e05e09318f153935231db40a054e
|
File details
Details for the file slidio-1.0.0-py3-none-any.whl.
File metadata
- Download URL: slidio-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b13500cbd6a8cd79d02b4c2f415477fce46bfda054777030c2d4fa540dc0d81
|
|
| MD5 |
3518ff6e691e71903ad0366b55214cb4
|
|
| BLAKE2b-256 |
0b978eaea140b82a2a28bdb13fe908a6df31943f5d069e2b4c55f07e0c9f713f
|