Table of Contents
AI-Generated PDF Reports from Excel – Workflow Documentation
Status: Internal guide (v1, English) Audience: All team members who create customer reports with AI support Scope: How to turn an Excel workbook into a professional, presentation-ready PDF report – what to do, what to tell the AI, and how to keep the process fast and reliable.
1. Purpose
Instead of manually building PowerPoint/Word reports from Excel data, the AI agent reads the workbook directly (all sheets, cell values and cell colors) and generates a multi-page A4 PDF with:
- Cover page with key figures
- Executive summary with KPI cards and status chart
- Distribution charts (areas, categories, timelines)
- Complete detail tables for every record in the file
- “Open items & recommended next steps” section
- Page header/footer, consistent company style – ready to send to the customer
The output is saved with the same name as the Excel file in a fixed folder: /home/user/Documents/generatedpdf/.
2. Workflow (5 Steps)
- Upload: Send the Excel file (`.xlsx`) as a chat attachment (or drop it into `Documents/inbox/`). - Prompt: Tell the AI what to build – language, style, output location. See the template in Section 3. - Analysis: The AI reads every sheet and cell, classifies statuses, computes KPIs, builds charts and renders the PDF. No data is copied by hand – nothing is lost or mistyped. - Delivery: The finished PDF appears in chat and on disk under its original filename. - Review & iterate: If something must change (wording, color, missing column), say it in one short message – the report is regenerated. Do not re-upload the file for small fixes.
Typical total time for a 300+ line workbook: a few minutes.
3. Prompt Template
Copy, fill the brackets, paste into a fresh chat together with the Excel attachment:
Read the attached Excel file "[FILENAME].xlsx" completely (all sheets, all cells, including cell colors used as status legend). Then create ONE professional PDF report in [GERMAN / ENGLISH] for a customer presentation. Requirements: - Same filename as the Excel file, saved to /home/user/Documents/generatedpdf/ - Cover page with the 4–5 most important numbers - Executive summary: KPI cards + one status overview chart - Charts: distribution by [AREA / CATEGORY / DATE – pick what fits the data] - Full detail table(s) of ALL rows – do not shorten or sample the data - Section "Open items & recommended next steps" derived from the status notes - Clean, modern design (dark blue cover, white content pages), A4 - Keep all original values and notes unchanged; only reformat the presentation After finishing: show me the PDF in chat.
Tips for a good prompt
- Name the output folder and filename rule explicitly (done above).
- State the target language – otherwise the AI may mix languages.
- Tell it which columns/words are statuses (e.g. “green = OK, red = open”) if colors carry meaning.
- Ask for a specific chart only if you want one – otherwise the AI picks sensible ones.
4. What the PDF Contains
- Cover: title, key KPIs, report date, document reference.
- Summary: KPI cards (totals, OK / fixed / open), status donut chart, 3 key messages.
- Distribution charts: e.g. records per area/hall, per category, per date.
- Detail tables: every single row of the source file with status badges (✔ fixed / ⏳ pending / ⚠ warning / open).
- Open items: each problem with its original note + recommended action, plus a numbered next-steps list.
- Footer: document name + page number on every page.
5. IMPORTANT – Context Size & Cleanup (read this!)
The AI chat has a limited memory window (“context”). Everything inside one chat – uploaded files, generated code, rendered pages – counts against it. A full workbook plus its report can consume a large share. Follow these rules:
- Start a NEW CHAT for every new document. Do not chain multiple Excel files in one conversation – the old report's data stays in memory, slows everything down, and can degrade quality or break the generation. - Delete working files after delivery. Ask once per chat: *“delete all temporary work files (scripts, images, HTML) from /tmp”*. The finished PDFs in `Documents/generatedpdf/` stay – those are the deliverables. - Delete old, unused chats in the chat list regularly. Finished project chats that you no longer need are safe to remove and free up space for future sessions. - Keep iterations short. One fix = one short message (“fix the typo on page 3”). Do not paste long explanations or screenshots of whole pages – that burns context fast. - If a chat gets very long or starts acting strange: start a new chat, re-upload the Excel file (it arrives fresh), and paste the same prompt from Section 3. The report is rebuilt from the file, not from the old chat – nothing is lost. - One document per chat keeps every run fast and identical in quality.
6. Tips for Best Results
- Clean Excel = clean report. One sheet per topic, meaningful column headers, one value per cell.
- Use a color legend row (as we do in our status sheets) – the AI reads cell fills and can reproduce your color coding in the PDF.
- Write statuses clearly, e.g. “fixed on 22.07.2026”, “open – waiting for electrician” – the AI turns these into badges, timelines and the open-items section automatically.
- Contradictory entries (e.g. a note saying “missing” but status saying “present”) are flagged in the report as “to verify on site” instead of being guessed – tell the customer which ones to check.
- Small changes after delivery: just describe them in one line; the AI regenerates the PDF in under a minute without re-reading everything.
7. Technical Appendix
| Component | Used for |
|---|---|
| Python 3 + openpyxl | Reading `.xlsx` values, formulas (cached results) and cell colors |
| matplotlib | All charts (donut, bar charts), exported as high-resolution PNG |
| WeasyPrint | Renders the styled HTML/CSS layout to an A4 PDF with headers/footers/page breaks |
| pdftoppm | Page previews for the AI's own quality check before delivery |
Pipeline: Excel → parsed into structured data (JSON) → statistics & KPIs computed → chart PNGs generated → single styled HTML document → PDF rendered to /home/user/Documents/generatedpdf/.
File locations
- Uploads: chat attachment, or `Documents/inbox/`
- Deliverables: `Documents/generatedpdf/<name>.pdf`
- Temporary work (deleted after delivery): `/tmp` (scripts, chart images, HTML)
Example commands used internally (for IT reference):
# inspect a workbook python3 -c "import openpyxl; wb=openpyxl.load_workbook('file.xlsx'); print(wb.sheetnames)" # render HTML to A4 PDF python3 -c "from weasyprint import HTML; HTML('report.html').write_pdf('out.pdf')" # generate page previews for visual QA pdftoppm -png -r 80 out.pdf preview
Summary in one line: upload the Excel, paste the prompt from Section 3 into a fresh chat, review the PDF that appears – then clean up and close the chat. One document per chat, always.
