This is an old revision of the document!
= Generating Professional PDF Reports from Excel Files Using AI (=builder)=
//Last updated: 12.10.2026 // //Owner: [Hrishabh] // //Status: Production-Ready //
1. Purpose
This document explains the repeatable process for converting raw Excel workbooks (e.g. camera inventory lists, status-quo tracking sheets) into professional, presentation-ready PDF reports using the AI assistant “builder”. No local Python environment, no design tools, and no manual layout work is required — the AI reads the data, analyses it, generates charts, and produces a print-ready A4 PDF in a single session.
2. Prerequisites
| Requirement | Details |
|---|---|
| AI tool | “builder” (web-based AI assistant with file-reading + code-execution capability) |
| Source file | An `.xlsx` workbook with the data to be reported (one sheet, structured rows/columns) |
| Access to output folder | `/home/user/Documents/generatedpdf/` (or any writable path) |
| Internet connection | Required for the builder session |
| No local installs needed | Python, openpyxl, matplotlib, and WeasyPrint are pre-installed in the builder environment |
3. Process Overview
The full workflow takes 5–10 minutes per report from file upload to finished PDF:
┌──────────────┐ ┌──────────────────┐ ┌─────────────────┐ ┌──────────┐ │ 1. Upload │ ──▶ │ 2. Instruct │ ──▶ │ 3. AI reads & │ ──▶ │ 4. Get │ │ Excel file │ │ (prompt + specs)│ │ generates PDF │ │ the PDF │ └──────────────┘ └──────────────────┘ └─────────────────┘ └──────────┘
Step-by-step:
# Upload the `.xlsx` file as an attachment in the chat (paperclip icon). # Describe what you want in plain language — see §5 for proven prompt templates. # The AI reads every row and column, detects structure, categories, statuses, and dates automatically. # The AI generates charts (donut, bar, timeline) and a full HTML/CSS report layout. # The AI renders the PDF (A4, with cover page, headers, footers, page numbers) into the target folder. # You receive the PDF as a clickable file link — download or forward to your customer.
4. Worked Examples
Example A: "AS von Status Quo.xlsx" → Status-Quo-Bericht
* Source data: 152 camera positions across 3 video systems (Video 1/2/3), color-coded by source (RE 1309, RE 1296, AN 1801, AN 1940, Alt Bestand, Parkraumüberwachung), with German status notes (“montiert aber nicht im System”, “BEHOBEN AM 24.07.2026”, etc.) * Output: 16-page PDF — `StatusQuo_Bericht_Kundenvorstellung.pdf` * Contents: * Cover page with KPIs (152 positions, 9 halls, 28 defects fixed, open items) * Executive summary with donut chart (OK / Behoben / Offen) * Distribution charts by hall and by camera source * Full detail tables per video system with color-coded status pills * Open-items table + AN-1940 order positions + KFZ recognition gaps * 4-step action plan for the customer
Example B: "Kamera Netzwerkliste.xlsx" → Systemstatus-Bericht
* Source data: 342 NVR camera entries (name, channel IP, device IP, area, firmware, model, network status, video signal, recording status, image diagnosis, arm status) * Output: 22-page PDF — `Kamera Netzwerkliste.pdf` * Contents: * Cover page with KPIs (342 cameras, 98.8% online, 7 NVRs, 4 offline) * Executive summary with status donut + key messages * Area distribution chart (WA außen 84, WE außen 76, Hallen 1–9, …) * NVR infrastructure table (7 recorders with IP, model, firmware, camera count) * Complete 342-row camera list with per-camera status pills * Offline-cameras table with recommended remediation steps
5. Prompt Templates (Copy & Paste)
Tip: The more specific your prompt, the better the first result. You can always iterate with follow-up messages (“change the color”, “add a logo placeholder”, “make section 3 shorter”).
5.1 Basic report generation
Read this Excel file. It is in [German/English]. Create a professional PDF report for customer presentation. Save it to /home/user/Documents/ generatedpdf/ with the same base name as the Excel file (e.g. "MyReport.pdf"). Include: cover page, executive summary with KPIs, charts, detail tables, and an open-items / action-plan section. The report must be in [German/English].
5.2 With specific design requirements
Read the attached Excel file and generate a customer-facing PDF report. Requirements: - Language: German - A4 format, professional corporate look (dark navy + gold accent) - Cover page with title, KPI cards, date - Donut chart for status overview - Bar charts for distribution by [area / hall / department] - Full detail table with all rows from the sheet - Color-coded status pills: green = OK, red = open issue, blue = resolved - Page footer with document name + page number - Save to: /home/user/Documents/generatedpdf/[Name].pdf
5.3 Iteration / correction
The report looks good. Please fix the following: 1. Change "Fehlkkanäle" to "Fehlkanäle" (typo) 2. Position 39 is already resolved — move it from "Offen" to "Behoben" 3. Add a section 6 with recommended next steps as numbered action items Regenerate the PDF in the same location.
6. What the AI Can and Cannot Do (Limitations)
Capabilities
* Read `.xlsx` files (all sheets, all cells, including merged cells and cell fills/colors) * Detect structure: headers, data rows, sections, color-coded categories * Parse German / English / mixed-language content * Generate matplotlib charts (donut, bar, timeline, stacked) * Render full HTML/CSS → PDF via WeasyPrint (A4, multi-page, cover, footers) * Handle 150–350+ row datasets in a single pass * Apply your color palette and brand colors from the Excel legend * Write report text in German or English (or both)
Limitations
| Limitation | Workaround |
|---|---|
| Cannot browse your file server — uploaded files only land in `/tmp` or `inbox/` | Upload the file as a chat attachment, or place it in `/home/user/Documents/inbox/` |
| Cannot access live systems (NVR, CRM, ERP) | Export the data to Excel first, then upload |
| No image/photo support from Excel (e.g. camera snapshots embedded in cells) | Provide photos as separate attachments if needed |
| Charts are matplotlib PNGs — not interactive SVG/HTML charts | Acceptable for print PDFs; for web, request HTML export instead |
| One session = one context window — very large workbooks (10k+ rows) may need splitting | Split the Excel into per-area/per-hall files, or ask the AI to process in batches |
7. Troubleshooting
Problem: "File not found on disk"
The attachment did not land where the AI expected it. Fix: # Ask the AI to run `find / -iname “*.xlsx”` and confirm the path. # If it's in `/home/user/Documents/inbox/` instead of `/tmp/`, tell the AI the correct path. # Worst case: re-upload the attachment in the same chat.
Problem: AI misread a column or mixed up two columns
Fix: Point to the specific row/column:
In row 14, column H says "montiert aber nicht im System" — that position should be listed as OPEN, not OK. Please re-check the status classification and regenerate the table.
Problem: Chart numbers don't add up
Fix: Ask the AI to print the per-category counts before generating the chart:
Before you render the donut chart, print the exact count for each category so I can verify the total equals 342.
Problem: PDF has a layout glitch (text overflow, missing page)
Fix: Request a targeted re-render:
Page 8 has text overflowing in the "Kamerabezeichnung" column. Reduce the font size of that table to 7pt and widen the name column to 32%. Regenerate only pages 6–14.
Problem: Wrong date or wrong language
Fix: Explicitly state in your prompt: “Report language: German. Report date: [DD.MM.YYYY].”
8. ⚠️ Context Size Management — READ BEFORE EACH SESSION
This is the single most important section. Ignoring it will cause failed sessions, truncated outputs, and lost work.
8.1 Why context size matters
Every message you send, every file the AI reads, and every response the AI generates all consume a shared context window (a finite token budget). Once the window is full: * The AI starts forgetting earlier instructions (“amnesia”) * Long outputs get truncated mid-sentence * File reads return partial data * In worst case, the session errors out and you must restart
8.2 Rules to follow (non-negotiable)
# Delete generated files after downloading. Every PDF, PNG, or HTML file left in the workspace can be re-read into the context if you ask the AI to inspect them again. Once you have your PDF, clean up:
rm /home/user/Documents/generatedpdf/OldReport.pdf rm /tmp/*.png /tmp/*.html
# Start a NEW chat for each new report. Do not chain 5 different Excel reports into one conversation. Each report is a self-contained task. A fresh chat = full context budget.
# Do NOT upload the same file twice. If you already attached `Report.xlsx` and the AI read it, do not re-attach it “just in case”. The AI already has it in memory.
# Delete unused / finished chats regularly. Old conversations stay stored server-side and can bloat your account's context history. In the chat list: * Go to each completed chat → Delete chat (or “Archive” if available). * Keep only the 1–2 active conversations.
# Keep prompts focused. One report per message. Don't paste in 500 lines of extra context, screenshots, and “by the way also…” all in one prompt.
# If a session feels “sluggish” or the AI repeats itself, that's the context window filling up. Stop, save your work, delete temp files, and start a new chat.
8.3 Quick "before I start a new report" checklist
[ ] Downloaded & verified the last PDF? [ ] Deleted /tmp/*.png, /tmp/*.html, old .pdf from workspace? [ ] Closed or deleted all other finished chats? [ ] New chat opened? [ ] Excel file attached ONCE? [ ] Prompt written with: language, output path, section list, style?
9. Additional Tips & Best Practices
* Name your files clearly. `Kamera Netzwerkliste.pdf` is better than `report_final_v3_actual.pdf`. The AI uses the Excel filename as the PDF name by default. * Keep the Excel clean. Remove hidden columns, stray rows, and merged header cells before uploading — it reduces misinterpretation risk. * Use the color legend in your sheet. If row 1 contains a color key (“Gelb: RE 1309, Grün: AN 1940…”), the AI will pick it up and use those exact colors in the report automatically. * Ask for a “dry run” on large files first:
Before generating the PDF, just list the categories and counts you detected so I can verify the structure is correct.
* Version control your reports. After each generation, copy the PDF to a dated subfolder:
mkdir -p /home/user/Documents/generatedpdf/archive/2026-10
cp "/home/user/Documents/generatedpdf/Kamera Netzwerkliste.pdf" \
/home/user/Documents/generatedpdf/archive/2026-10/
* For recurring reports (monthly camera status), save your prompt as a DokuWiki snippet or text file so you never have to rewrite it. * The AI cannot see what is NOT in the Excel. If a camera was removed on Monday, the report reflects the Excel — not the live system. Always export fresh data.
10. File Locations Quick Reference
| Path | Purpose |
|---|---|
| `/home/user/Documents/generatedpdf/` | Output folder for all generated PDFs |
| `/home/user/Documents/inbox/` | Staging area — drop Excel files here if attachment upload fails |
| `/tmp/AS.xlsx`, `/tmp/cams.json`, etc. | AI working files (charts, parsed JSON) — safe to delete after each session |
11. Revision History
| Date | Author | Change |
|---|---|---|
| 12.10.2026 | [Your Name] | Initial version: process, examples A+B, prompts, context management guide |
//Questions or improvements? → feedback //
