🚀 A powerful Python automation tool that revolutionizes the way you create PowerPoint presentations from Excel data. Perfect for business reports, data presentations, and automated document generation.
- 🎯 Save Hours of Work: Automate the tedious process of copying data from Excel to PowerPoint
- 🔄 Real-time Updates: Change your Excel data, and your PPT updates automatically
- 🎨 Preserve Design: Keep your PowerPoint template design while updating only the data
- 📊 Rich Content Support: Handle text, tables, charts, and images with ease
- 🛠 User-Friendly: Simple template markup language that anyone can learn in minutes
- Automatic Data Mapping: Read data from Excel files and automatically replace placeholders in PPT templates
- Multiple Content Support: Support text, tables, charts, images, and various PowerPoint content types
- PTML Markup Language: Use simple
${variable}syntax to mark content for replacement - Smart File Handling: Automatic detection and handling of file occupation
- Process Management: Automatic PowerPoint process management to avoid conflicts
- Text Data: Plain text, percentages, numerical values, etc.
- Date Data: Automatic date formatting
- Table Data: Dynamic table content replacement
- Chart Data: Support for column charts, line charts, combo charts, etc.
- Image Data: Dynamic image replacement
- Case Insensitive: Support case-insensitive key name matching
- Percentage Smart Processing: Automatic recognition and formatting of percentage data
- Combo Chart Support: Support for column+line combination charts
- Safe File Saving: Retry mechanism for safe file saving
- Detailed Logging: Complete processing logs
- Python 3.6+
- Windows OS (COM component support required)
win32com.client # Windows COM component
pandas # Data processing
openpyxl # Excel file reading
psutil # Process management
- Microsoft PowerPoint 2016+
- Microsoft Excel 2016+
- Clone Project
git clone https://github.com/your-repo/ExcelPPTSliderMapper.git
cd ExcelPPTSliderMapper- Install Dependencies
pip install -r requirements.txt- Install pywin32
pip install pywin32from src.excel_ppt_mapper.excel_ppt_mapper import process_ptml_template, read_excel_template
# File paths
ppt_template = "template.pptx"
excel_data = "data.xlsx"
output_file = "result.pptx"
# Read Excel data
template_data = read_excel_template(excel_data)
# Process PPT template
success = process_ptml_template(
ppt_path=ppt_template,
template_data=template_data,
output_path=output_file,
page_numbers=[1, 2, 3] # Optional: specify pages to process
)
if success:
print("✅ PPT processing completed")
else:
print("❌ PPT processing failed")Use the following markup in PowerPoint templates:
${variable} # Direct replacement without any conversion
Examples:
${company_name}→ "Wucang Technology Co., Ltd"${growth_rate}→ "25%"${report_date}→ "2024-01-15"
| Key | Value |
|---|---|
| company_name | Wucang Technology Co., Ltd |
| growth_rate | 25% |
| revenue | 10M |
| Key | Value |
|---|---|
| report_date | 2024-01-15 |
| end_date | 2024-12-31 |
| Column | Description |
|---|---|
| table_name | Table name |
| header | Header row |
| data | Data rows |
| Chart Name | Category | Series Type | Series Name | Value | Chart Type | Title |
|---|---|---|---|---|---|---|
| sales_chart | Q1 | column | Sales | 100 | combo | Quarterly Sales Analysis |
| sales_chart | Q1 | line | Growth Rate | 15 | combo | Quarterly Sales Analysis |
| Key | Value |
|---|---|
| company_logo | ./images/logo.png |
| product_image | ./images/product.jpg |
Main function for processing PPT templates
Parameters:
ppt_path(str): PPT template file pathtemplate_data(Dict): Template data dictionaryoutput_path(str, optional): Output file pathpage_numbers(List[int], optional): List of page numbers to process
Returns:
bool: Whether processing was successful
Read template data from Excel file
Parameters:
excel_path(str): Excel file path
Returns:
Dict[str, Any]: Template data dictionary
Check if a file is being used
Close all PowerPoint processes
Safely save presentation with retry mechanism
# Process all pages
template_data = read_excel_template("data.xlsx")
process_ptml_template("template.pptx", template_data, "output.pptx")# Only process pages 1-3
template_data = read_excel_template("data.xlsx")
process_ptml_template(
"template.pptx",
template_data,
"output.pptx",
page_numbers=[1, 2, 3]
)In PPT Template:
Company: ${company_name}
Growth Rate: ${growth_rate}
Excel Data:
| Key | Value |
|---|---|
| company_name | Wucang Tech |
| growth_rate | 25% |
Result:
Company: Wucang Tech
Growth Rate: 25%
- File Permissions: Ensure sufficient read/write permissions
- File Occupation: Program automatically handles file occupation issues
- Backup Important Files: Recommend backing up original files before processing
- Version Compatibility: Recommend Office 2016 or above
- Macro Security: May need to adjust PowerPoint macro security settings
- Process Cleanup: Program automatically cleans up PowerPoint processes
- Encoding Issues: Recommend using UTF-8 encoding for Excel files
- Data Types: Ensure consistency in number, text, and date formats
- Special Characters: Avoid special characters in key names
- Large File Processing: Large PPT files may require longer processing time
- Memory Usage: Complex charts may use more memory
- Concurrency Limitation: Not recommended to run multiple instances simultaneously
Q: "File in use" message A: Program will automatically close PowerPoint processes; if issues persist, manually close all Office programs
Q: Markers not replaced A: Check if Excel key names exactly match PPT markers (case-insensitive matching supported)
Q: Chart data update failed A: Ensure correct chart data format in Excel, especially for numerical values
Q: Program running slowly A: May be due to large PPT files or complex charts, please be patient
Program provides detailed log output, check console output for diagnostics.
This project is licensed under the MIT License - see the LICENSE file for details
Issues and Pull Requests are welcome to help improve this project!
If you encounter any problems or have feature suggestions, please:
- Check the troubleshooting section of this document
- Search existing Issues
- Create a new Issue
Note: This tool requires Windows environment and depends on Microsoft Office suite.

