In this tutorial, we will generate detailed, multi-slide sales data reports for multiple companies using a self-hosted Presenton’s API and a Python script. This tutorial extends Generate a PPT via API in 5 Minutes and shows you how to automate the creation of structured sales reports from a CSV file using Python. So, do check it before continuing with this and make sure you have Presenton running locally or on any server, and you are able to generate presentations with it.Documentation Index
Fetch the complete documentation index at: https://docs.presenton.ai/llms.txt
Use this file to discover all available pages before exploring further.
1. Prepare Your CSV File
Save your sales data assales_data.csv:
2. Install Python Requirements
You’ll need therequests and pandas libraries:
3. Write the Python Script
Let’s build the script step by step.a. Import Libraries
b. Create reports directory
c. Load the CSV
d. Group Data by Company
e. Define a Function to Build the Prompt
f. Loop Over Each Company and Generate a Report
reports directory.
Download complete code from github.
4. Run the Script
Save your script asgenerate_sales_reports.py and run:
5. How It Works
- The script reads and groups your CSV by company.
- It builds a well-structured markdown prompt for Presenton’s API (see API Reference).
- It sends a POST request to generate a report for each company.
- The API returns a download path for each generated PDF.
- The file is downloaded and saved in the
reportsfolder.
6. Next Steps
- You can further customize the prompt or number of slides as needed.
- For more on API options, see Generate a PPT via API in 5 Minutes.
- To edit created presentation you can follow Edit Custom Presentation Using API.
- For advanced configuration (for example, using Ollama or GPU), see Environment Variables, Using GPU, and Using Ollama Models.
Need help? See the full documentation or open an issue on GitHub.