Skip to content

๐ŸŽจ A4: Document Generator

Primary Feature: Office Artifact Creation (Word, Excel, PowerPoint) Status: โœ… Built (Corp) โ€” Excel and template scenarios strongest Built in: Corp โœ… 2026-04-08 | Lab โฌœ


๐ŸŽฏ Problem It Solves

"I spend hours every week formatting reports, building trackers, and creating presentations from scratch."

This agent generates polished Office documents from:

  • Text input โ†’ structured Word/Excel/PPT
  • Raw data upload โ†’ clean formatted output
  • Templates โ†’ filled-in professional documents

Why This Agent?

This is our Office Artifact Creation showcase. It's the first agent where we turn ON the "Generate documents, charts, and code" capability โ€” the agent doesn't just answer questions, it creates downloadable files.

Key Contrast with Previous Agents

Agent What It Does Creates Files?
A01 Answers from web โŒ Chat only
A02 Answers from docs โŒ Chat only
A03 Rewrites text โŒ Chat only
A04 Generates documents โœ… Word, Excel, PowerPoint

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   Three Input Scenarios                        โ”‚
โ”‚                                                                โ”‚
โ”‚  ๐Ÿ“ Scenario 1: Text in chat                                 โ”‚
โ”‚  ๐Ÿ“Ž Scenario 2: Template in knowledge + user data             โ”‚
โ”‚  ๐Ÿ“ค Scenario 3: Raw data file uploaded in chat                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              Document Generator Agent                          โ”‚
โ”‚                                                                โ”‚
โ”‚  ๐Ÿ“ Instructions (multi-scenario handling)                    โ”‚
โ”‚  ๐Ÿ“‹ Knowledge: weekly-report-TEMPLATE.docx                    โ”‚
โ”‚  โšก Capability: Generate documents, charts, and code = ON     โ”‚
โ”‚                                                                โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚
โ”‚  โ”‚  Code Interpreter / Document Engine                 โ”‚      โ”‚
โ”‚  โ”‚  โ€ข Reads uploaded files                             โ”‚      โ”‚
โ”‚  โ”‚  โ€ข Generates Word (.docx)                           โ”‚      โ”‚
โ”‚  โ”‚  โ€ข Generates Excel (.xlsx) โ† STRONGEST              โ”‚      โ”‚
โ”‚  โ”‚  โ€ข Generates PowerPoint (.pptx) โ† WEAKEST           โ”‚      โ”‚
โ”‚  โ”‚  โ€ข Creates charts and summaries                     โ”‚      โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ”‚                                                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ“ฅ Downloadable Office Document                              โ”‚
โ”‚     (User clicks to download Word/Excel/PPT file)             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœ… Capabilities Used

Capability Used? Details
SharePoint Knowledge โŒ Not used
Web Grounding โŒ Not used
File Uploads (knowledge) โœ… Template file uploaded as knowledge reference
Graph Connectors โŒ Not used
Office Artifacts โœ… THE star feature โ€” "Generate documents, charts, and code" = ON
Tool Groups โŒ Not used
Copilot Actions โŒ Not used
Instructions โœ… Multi-scenario document generation with 3 input modes
Starter Prompts โœ… 5 working (Word, Excel, PPT, raw data, template) + 1 boundary

๐Ÿ“ Instructions Used

Copy-paste these instructions when building the agent:

You are the Document Generator โ€” a professional business document creator. You turn rough notes, raw data, and verbal summaries into polished Office documents (Word, Excel, PowerPoint).

## Three Ways to Generate Documents

### Scenario 1: Text to Document
User provides text information in the chat. You generate a polished document from it.
- For reports and written content โ†’ generate Word (.docx)
- For data, tables, and trackers โ†’ generate Excel (.xlsx)
- For presentations and pitches โ†’ generate PowerPoint (.pptx)

### Scenario 2: Template-Based Generation
A template file exists in your knowledge sources. When the user says "use the template" or asks for a report in "our format":
1. Reference the template file to understand the required structure and sections
2. Fill in the template sections with the data the user provides
3. Match the section headings, order, and table formats from the template
4. Mark any sections without data as "[TO BE COMPLETED]"

### Scenario 3: Raw Data to Clean Output
User uploads a messy or raw data file (Excel, CSV). You:
1. Read and analyse the uploaded data
2. Clean and structure it
3. Generate a polished output document (Word summary report, clean Excel, or presentation with charts)

## Rules You MUST Follow
1. ALWAYS ask clarifying questions if the user's request is vague โ€” do not assume
2. ALWAYS generate the document as a downloadable Office file
3. Use professional formatting: clear headings, consistent fonts, bullet points, tables
4. Use NZ English spelling (colour, organise, centre)
5. Include the current date on all documents
6. Keep language professional but warm โ€” not stiff or corporate
7. NEVER fabricate data, statistics, or facts โ€” ONLY use what the user provides
8. If information is missing for a section, mark it as "[TO BE COMPLETED]"
9. When a template exists in knowledge, ALWAYS follow its structure unless the user says otherwise
10. After generating, ALWAYS offer to adjust: format, sections, tone, or file type

## What You Do NOT Do
- NEVER create legal contracts, financial statements, or compliance documents. If asked, respond: "I can create business documents like reports, trackers, and presentations, but legal and financial documents should be prepared by qualified professionals."
- NEVER make up content that the user has not provided
- NEVER change the meaning of user-provided data

๐Ÿ› ๏ธ Quick Build Guide (Copy-Paste Ready)

Follow these steps to recreate this agent in any tenant:

Step Action
1 Go to microsoft365.com/chat โ†’ Agents โ†’ Create Agent โ†’ Skip to configure
2 Name: A04: Document Generator
3 Description: Generates polished Word reports, Excel trackers, and PowerPoint decks โ€” from text, raw data uploads, or using templates
4 Instructions: Paste the full instruction block from above
5 Knowledge โ†’ Files: Upload weekly-report-TEMPLATE.docx from C:\ssClawy\agent-builder-demo-content\a04-document-generator\
6 Knowledge โ†’ Web content: None
7 Search all websites: OFF
8 Generate documents, charts, and code: โœ… ON (critical โ€” this is the star feature!)
9 Starter Prompts: Add all prompts from the table below
10 Create and test with T2 (Excel) first โ€” it's the most reliable

Demo Files to Have Ready (attach during demo, NOT uploaded as knowledge)

File Location Used In
raw-team-performance-data.xlsx a04-document-generator/ T4 prompt (attach in chat)

๐Ÿšจ Gotchas & Design Decisions

๐Ÿ“Š Gotcha 1: Excel Is the Strongest, PowerPoint Is the Weakest

โš ๏ธ Honest Assessment from Testing

Not all artifact types are equal. Here's what we found:

Artifact Type Reliability Formatting Quality Demo Safe?
Excel (.xlsx) โญโญโญ Excellent Clean tables, headers, formatting โœ… Lead with this
Word with template โญโญ Good Follows template structure well โœ… Use template approach
Word freeform โญ Basic Alignment and styling often messy โš ๏ธ Manage expectations
PowerPoint (.pptx) โŒ Unreliable Often fails to generate the file โŒ Skip in live demos

Why: The Code Interpreter engine excels at structured data (Excel) and can follow templates (Word). But freeform Word formatting and PowerPoint slide generation are weaker capabilities โ€” the engine struggles with complex layouts and visual design.

Customer positioning: "Document generation is strongest with structured data and templates. For presentations, we recommend using Copilot in PowerPoint directly โ€” it has dedicated slide generation AI that's much better than the general Code Interpreter."

๐Ÿ“‹ Gotcha 2: Templates Dramatically Improve Word Output

Our T1 test (freeform Word) produced messy formatting. But T5 (template-based Word) produced clean, well-structured output. The template gives the agent a reference to follow.

Lesson: ALWAYS provide templates for Word document generation. Upload them as knowledge files and reference them in instructions.

๐Ÿ“ค Gotcha 3: Raw Data Upload Is the Biggest Wow Factor

T4 (upload messy Excel โ†’ get clean executive summary) was the most impressive demo moment. The agent:

  1. Read the raw performance data
  2. Calculated averages and identified top performers
  3. Generated a clean Word report with tables and recommendations

Demo tip: Lead with T2 (Excel) for quick win, then T4 (raw data) for the wow factor, then T5 (template) to show sophistication.


๐Ÿ’ฌ Starter Prompts

# Title Scenario Output Reliability
T1 ๐Ÿ“„ Word from Text Text โ†’ Word freeform Word (.docx) โญ Basic formatting
T2 ๐Ÿ“Š Excel from Text Text โ†’ Excel tracker Excel (.xlsx) โญโญโญ Excellent
T3 ๐Ÿ–ฅ๏ธ PPT from Text Text โ†’ PowerPoint deck PPT (.pptx) โŒ Often fails
T4 ๐Ÿ“Š Raw Data โ†’ Clean Upload raw file โ†’ clean report Word + data โญโญโญ Best demo moment
T5 ๐Ÿ“‹ Template โ†’ Filled Template + data โ†’ formatted doc Word (.docx) โญโญ Good with template
B1 ๐Ÿšซ Legal Contract Boundary test Decline โœ… Works
  1. T2 (Excel) โ†’ quick win, always works
  2. T4 (raw data upload) โ†’ biggest wow
  3. T5 (template-based) โ†’ shows sophistication
  4. Skip T3 (PPT) in live demos โ€” or mention as "still maturing"

๐Ÿ“ Demo Files

File Location Purpose
weekly-report-TEMPLATE.docx a04-document-generator/ Template for T5 (uploaded as knowledge)
raw-team-performance-data.xlsx a04-document-generator/ Raw data for T4 (attached in chat during demo)

๐Ÿงช Test Results

# Test Result Notes
T1 Word from text โš ๏ธ Works but messy formatting Alignment issues, basic styling
T2 Excel from text โœ… Excellent Clean table with headers, proper formatting
T3 PPT from text โŒ Failed Could not generate .pptx file
T4 Raw data โ†’ report โœ… Excellent Analysed data, calculated averages, clean output
T5 Template โ†’ filled โœ… Good Followed template structure, filled sections correctly
B1 Legal contract โœ… Declined CAPS boundary technique working

๐Ÿ‘ Pros & Cons

Pros Cons
โœ… Creates actual downloadable Office files โŒ PowerPoint generation unreliable
โœ… Excel output is excellent quality โŒ Freeform Word formatting often messy
โœ… Raw data processing is genuinely impressive โŒ Can't perfectly replicate complex templates pixel-for-pixel
โœ… Template-based generation works well โŒ Requires "Generate docs" capability ON (can't keep it off)
โœ… Three input modes (text, template, raw data) โŒ Large files may hit processing limits

๐Ÿ”ฎ Future Enhancements

Enhancement Impact
Better PPT generation Would complete the Office trifecta
Brand-specific formatting (colours, fonts, logos) More professional output
Multi-document generation in one request "Generate the report AND the tracker AND the deck"
Combine with SharePoint knowledge Pull real project data and generate reports automatically
Scheduled generation via Copilot Actions Auto-generate weekly reports every Friday

๐ŸŽค Demo Talking Points

  1. "Three input modes" โ€” Type text, use a template, or upload raw data. Three ways to generate documents.
  2. "Excel is incredible" โ€” Show T2 and T4. Structured data is where this shines.
  3. "Templates change everything" โ€” Compare T1 (messy) vs T5 (clean). Templates are the key to consistent output.
  4. "Raw data magic" โ€” Drop a messy spreadsheet in, get an executive summary out. That's the wow moment.
  5. "Be honest about PPT" โ€” PowerPoint generation is still maturing. For best results, use Copilot in PowerPoint directly.
  6. "This is just the beginning" โ€” Imagine combining this with SharePoint data and scheduled automation.

โ† Back to Agent Builder Overview