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
reports
folder.
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.