Schema-driven Office document generation
Project description
Fast Office
A schema-driven Python package for generating Microsoft Office documents programmatically.
fast-office provides a structured and strongly-typed API for creating:
- Microsoft Word documents (
.docx) - Microsoft PowerPoint presentations (
.pptx) - Microsoft Excel workbooks (
.xlsx)
The package is designed for applications that need reliable document generation at scale, including:
- AI document generation systems
- Automated reporting pipelines
- SaaS reporting platforms
- Workflow automation systems
- Data export engines
fast-office abstracts document creation into clean Python specifications using typed models powered by Pydantic.
Built on
fast-office leverages:
python-docxpython-pptxopenpyxllxml
Installation
Using pip
pip install fast-office
Using uv
uv add fast-office
Core Concepts
Specifications
Each document type uses a specification model.
Examples:
DocxSpecPptxSpecWorkbookSpec
These specs define:
- Content
- Layout
- Styling
- Metadata
- Formatting
The generator then convert the specification into an Office document.
DOCX Example
Create a Word Document
from fast_office.documents.docx import DocxGenerator
from fast_office.types.docx import (
DocxHeading,
DocxParagraph,
DocxSection,
DocxSpec,
)
spec = DocxSpec(
title="Quarterly Report",
author="Finance Team",
font_name="Calibri",
font_size=11,
sections=[
DocxSection(
elements=[
DocxHeading(
text="Executive Summary",
level=1,
),
DocxParagraph(
text="Revenue increased by 18% year-over-year."
),
]
)
]
)
generator = DocxGenerator(spec)
path = generator.generate()
print(path)
DOCX Features
Paragraphs
Supports:
- Alignment
- Styling
- Custom fonts
- Colors
- Rich formatting
Tables
Generate structured tables with:
- Headers
- Cell formatting
- Borders
- Alignment
- Width controls
Images
Insert:
- Local images
- Positioned images
- Resized images
Headers & Footers
Configure:
- Header text
- Footer text
- Dynamic page numbers
PPTX Example
Create a PowerPoint Presentation
from fast_office.documents.pptx import PptxGenerator
from fast_office.types.pptx import (
PptxSlide,
PptxSpec,
)
spec = PptxSpec(
title="Startup Pitch Deck",
slides=[
PptxSlide(
title="Problem",
body="SMEs struggle with financial visibility.",
speaker_notes="Focus on market pain points."
),
PptxSlide(
title="Solution",
bullet_points=[
"Automated reporting",
"AI financial insights",
"Real-time dashboards",
]
),
]
)
generator = PptxGenerator(spec)
path = generator.generate()
print(path)
PPTX Features
Slide Layouts
Supports multiple slide layouts including:
- Title slides
- Title + content
- Blank slides
- Custom positioned layouts
Speaker Notes
Attach notes for presenters directly to slides.
Charts
Generate chart-based slides using structured chart data.
Supported chart types include:
- Bar charts
- Column charts
- Pie charts
- Line charts
Custom Elements
Add positioned:
- Text blocks
- Shapes
- Images
- Charts
using coordinate-based placement.
XLSX Example
Create an Excel Workbook
from fast_office.documents.workbook import WorkbookGenerator
from fast_office.types.workbook import (
WorkbookSpec,
WorksheetSpec,
)
spec = WorkbookSpec(
sheets=[
WorksheetSpec(
title="Revenue",
cells={
"A1": "Month",
"B1": "Revenue",
"A2": "January",
"B2": 120000,
"A3": "February",
"B3": 148000,
}
)
]
)
generator = WorkbookGenerator(spec)
path = generator.generate()
print(path)
Advanced XLSX Features
Conditional Formatting
Supports:
- Color scales
- Data bars
- Formula rules
- Threshold-based highlighting
Data Validation
Add spreadsheet validation such as:
- Dropdown lists
- Numeric ranges
- Date restrictions
- Formula validations
Charts
Generate embedded Excel charts from worksheet data.
Worksheet Protection
Protect:
- Worksheets
- Cells
- Workbook structures
Named Ranges
Create reusable named ranges for:
- Formulas
- Reporting
- Financial models
AI & Automation Use Cases
fast-office is especially useful for AI-native systems.
Example Use Cases
Financial Report Generation
Generate:
- Investment memos
- Financial statements
- Business valuation models
- KPI dashboards
Pitch Deck Automation
Automatically create:
- Startup decks
- Investor teasers
- Sales presentations
- Strategic reports
AI Agents
Integrate into:
- LangGraph agents
- Workflow orchestration systems
- Multi-agent pipelines
- LLM document workflows
Enterprise Reporting
Generate:
- Weekly reports
- Board reports
- Operational summaries
- Compliance documents
Architecture Overview
User Input
↓
Pydantic Specifications
↓
Document Generators
↓
Underlying Office Engines
↓
Generated Office Files
Design Philosophy
1. Declarative APIs
Documents should be described, not manually assembled.
2. Strong Validation
Invalid document structures should fail early.
3. Extensibility
The architecture supports future additions such as:
- PDF generation
- HTML export
- Template engines
- Theme systems
- Dynamic layouts
4. AI Compatibility
The specification-based design makes the package ideal for:
- Structured outputs
- Tool calling
- LLM pipelines
- Agentic workflows
Supported Python Versions
- Python 3.12+
Dependencies
Core dependencies include:
python-docxpython-pptxopenpyxlpydanticlxml
Roadmap
Potential future features:
- Template rendering engine
- HTML → DOCX conversion
- PDF export
- Markdown support
- Theme packs
- Dynamic table generation
- Advanced charting
- OpenXML-level editing
- Streaming document generation
- Cloud storage integrations
Contributing
Contributions are welcome.
Areas that can benefit from contribution include:
- Additional document components
- New chart types
- Template systems
- Performance optimizations
- Improved typing
- Documentation
- Testing coverage
Example Applications
Automated Financial Reports
report = build_financial_report(data)
path = report.generate()
AI Generated Pitch Decks
deck = build_pitch_deck(startup_data)
path = deck.generate()
Spreadsheet Exports
workbook = build_workbook(dataset)
path = workbook.generate()
License
MIT License
Summary
fast-office provides a structured, and extensible way to generate Office documents programmatically.
It abstracts away low-level Office APIs while maintaining flexibility, strong typing, and compatibility with automation systems.
Whether you are building:
- AI agents
- Reporting systems
- SaaS products
- Financial tooling
- Enterprise automation
fast-office offers a clean foundation for scalable document generation.
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 fast_office-0.1.0.tar.gz.
File metadata
- Download URL: fast_office-0.1.0.tar.gz
- Upload date:
- Size: 82.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d64b751627e2a1413274bf87ca7bd02113dbbda8adc5c2b0ccb3a84409c8a755
|
|
| MD5 |
da5cb7ed012612223136ad251597e3aa
|
|
| BLAKE2b-256 |
a793c2b161ad2b0c77e20b84ca2f54c1a033efd2bc8c8eaa532cf4ca99160b4b
|
File details
Details for the file fast_office-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fast_office-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a466c86271c853658f73bbba4fe3b352db9f60474ae547d60aedd6ca85d5a094
|
|
| MD5 |
74b2c8eeaca153c3b5f8ee5a24fababc
|
|
| BLAKE2b-256 |
a9ae86385c4fc7e74a15929faa8fdb16eed6b84e1a5515de3671bd58e6f214e3
|