Skip to content
This documentation is currently in preview, therefore subject to change.

Build a Power Automate Flow


You’ll achieve: A working Power Automate flow that generates a PDF from your template.


Before You Start

You need:


How to Create Your Flow

  1. Go to Power Automate
  2. Click + CreateInstant cloud flow
  3. Choose Manually trigger a flow
  4. Click Create
  5. Name it: e.g. Generate Invoice PDF

Success: Your flow is created.


How to Add Your Template

  1. Click + New step
  2. Search for OneDrive for Business
  3. Select Get file content
  4. Click folder icon
  5. Select your template (e.g., Invoice-Template.docx)

Success: Flow can now access your template.


How to Add Build a Doc Action

  1. Click + New step
  2. Search for Build a Doc
  3. Select Convert Word Document

First time only:

Before setting up the connection, you will need:

Once you have these to hand:

  1. Enter connection name: Build a Doc Production
  2. Paste (don’t type) your API key
  3. Click Create

How to Configure the Action

Fill in these fields:

Document

  1. Click in the Document field
  2. Select File Content from the dynamic content picker (from your “Get file content” step)

Data Source - Name

Enter: Invoice

This name must match your template tags (e.g., <<[Invoice.InvoiceNumber]>>)


Data Source - Data

Paste this JSON into the Data field:

[
{
"Name": "Invoice",
"Data": {
"invoice_number": "INV-2023-001",
"bill_to": {
"name": "John Smith",
"customer_id": "12345",
"address": "123 Main St, Suite 100",
"phone": "0123456789"
},
"payment_due_date": "2023-03-16",
"sales_person": "Mary Johnson",
"payment_terms": "Net 30",
"items": [
{
"sku": "SKU-001",
"description": "Product A",
"quantity": 2,
"price": 10.0
},
{
"sku": "SKU-002",
"description": "Product B",
"quantity": 1,
"price": 20.0
}
]
}
}
]

Data Source - Format

Select: JSON


Output Format

Select: PDF (or DOCX if you prefer Word format)


Alternative: Using a Public API as Your Data Source

Instead of hardcoding JSON data, you can fetch live data from public APIs and use it to populate your documents dynamically.

How to Add an HTTP Request

  1. Before adding the Build a Doc action, click + New step
  2. Search for HTTP
  3. Select HTTP (the standard connector)
  4. Configure the request:
    • Method: Select GET
    • URI: Paste this URL:
      https://api.open-meteo.com/v1/forecast?latitude=41.3888&longitude=2.159&hourly=temperature_2m&forecast_days=1&temporal_resolution=hourly_6

Success: This will fetch today’s temperature forecast for Barcelona.


Understanding the API Response

The Open-Meteo API returns JSON data in this structure:

[
{
"latitude": 41.375,
"longitude": 2.125,
"generationtime_ms": 0.03826618194580078,
"utc_offset_seconds": 0,
"timezone": "GMT",
"timezone_abbreviation": "GMT",
"elevation": 44.0,
"hourly_units": {
"time": "iso8601",
"temperature_2m": "°C"
},
"hourly": {
"time": [
"2026-02-06T00:00",
"2026-02-06T06:00",
"2026-02-06T12:00",
"2026-02-06T18:00"
],
"temperature_2m": [12.5, 11.1, 16.6, 13.6]
}
}
]

How to Use API Data in Build a Doc

Now when you configure the Build a Doc action:

  1. Document: Select your template file content (as before)
  2. Data Source - Name: Enter Weather
  3. Data Source - Data:
    • Click in the field
    • From the dynamic content picker, select Body (from the HTTP action)
    • This passes the entire API response as your data source
  4. Data Source - Format: Select JSON
  5. Output Format: Select your preferred format (PDF or DOCX)

How to Reference API Data in Your Template

In your Word template, you can now reference the API data using template tags:

Location: <<[Weather.latitude]>>, <<[Weather.longitude]>>
Timezone: <<[Weather.timezone]>>
Temperature Readings:
<<foreach [reading in Weather.hourly.time]>>
- Time: <<[reading]>> - Temperature: <<[Weather.hourly.temperature_2m]>> °C
<</foreach>>

Success: Your document will now be populated with live weather data from the API.


Why Use Public APIs?

Using public APIs as data sources enables powerful automation scenarios:

  • Live reporting: Generate documents with real-time data (weather, stock prices, exchange rates)
  • Integration: Combine data from multiple sources (CRM + weather + calendar)
  • Reduced manual work: No need to copy-paste data into templates
  • Always current: Documents reflect the latest information at generation time

How to Save the Output

  1. Click + New step
  2. Search for OneDrive for Business
  3. Select Create file
  4. Configure:
    • Folder Path: Select destination folder
    • File Name: Invoice.pdf (must match output format)
    • File Content: Select Document (from Build a Doc action)

Success: PDF will be saved to OneDrive.


How to Test Your Flow

  1. Click Save
  2. Click Test
  3. Select Manually
  4. Click TestRun flowDone

Watch each action:

  • ✅ Green checkmark = success
  • ❌ Red X = error

Success: Find your generated PDF in OneDrive.


How to Fix Common Errors

Problem✅ Solution
”401 Unauthorised”Verify API key, check subscription is active
Blank fields in PDFCheck JSON keys match template tags exactly
”File Not Found”Re-select template using folder picker
Wrong file extensionUse .pdf for PDF output, .docx for Word

Quick Checklist

Before running:

  • API key configured in connection
  • Template accessible from OneDrive/SharePoint
  • JSON structure matches template tags
  • Data source Name matches template root object
  • Output format specified (PDF/DOCX)
  • File name has correct extension

What You’ve Achieved

You now have:

  • A working Power Automate flow
  • Automated PDF generation
  • Knowledge of how to troubleshoot errors

Congratulations! You’ve completed the Build a Doc quickstart journey. Your automation flow is now ready to generate documents automatically.