Skip to main content

Mail Merge with Data String List of Docs in Power Automate

PDF4me Mail Merge with Data String List of Docs is a Power Automate action that turns one Word or PDF template plus a JSON data array into a batch of personalized documents in a single call. Use it to generate offer letters, certificates, or account notices for an entire list of recipients without looping the merge template through the flow one record at a time.

What this action does

PDF4me Mail Merge with Data String List of Docs maps a Word or PDF merge template plus a JSON data array, and returns an array of generated documents, one per data row. Both an array-of-arrays and an array-of-objects Data string shape are supported.

Related Blog Posts(1)

Authenticating Your API Request

To access the PDF4me Web API through Power Automate, every request must include a valid API key. Authentication validates your identity and enables the connector to reach PDF4me's mail merge service from your flow.

Important Facts You Should Not Miss

One call, one document per data row
A single action call returns the full Output Documents array, there is no need to loop the template mapping per recipient.
Two supported Data string shapes
Use an array-of-arrays with a header row, or an array of field/value objects, whichever is easier to build from your prior action's output.
Templates can be Word or PDF
Template File Data accepts either a .docx or a .pdf file, as long as it contains merge fields matching the Data string's column or field names.
Power Automate PDF4me Mail Merge with Data String action showing Template File Data, Template File Name, and Data string fields

Map Template File Data and Template File Name, then build the Data string as a JSON array with one entry per document to generate.

Parameters

Required: All three fields, Template File Data, Template File Name, and Data string, must be provided for the action to run.

ParameterRequiredWhat it doesExample
Template File DataRequiredContent of the merge template, mapped from a prior action such as SharePoint or OneDrive Get File Content. Must be a .docx or .pdf file containing merge fields.[Template Content]
Template File NameRequiredName of the template file including its extension, used for processing identification.LetterTemplate.docx
Data stringRequiredJSON data to merge into the template. Accepts an array-of-arrays with a header row followed by value rows, or an array of field/value objects. Each row or object after the header generates one document.[["Name","Email"],["John","[email protected]"]]

What Does Mail Merge with Data String Return?

FieldTypeWhat it contains
Output DocumentsArray of ObjectsOne entry per generated document, directly iterable with Apply to each.
File ContentBinaryBinary content of each generated document, nested inside each Output Documents entry.
File NameStringFile name of each generated document, nested inside each Output Documents entry.
{
"Output Documents": [
{ "File Content": "[Binary Content]", "File Name": "Letter_001.pdf" },
{ "File Content": "[Binary Content]", "File Name": "Letter_002.pdf" }
]
}

How Do I Set Up Mail Merge with Data String in Power Automate?

  1. Add PDF4meMail Merge with Data String List of Docs to your Power Automate flow.
  2. Map Template File Data and Template File Name from a template stored in SharePoint or OneDrive, containing merge fields that match your data columns.
  3. Build Data string as a JSON array, either a header row followed by value rows, or an array of field/value objects, one entry per document to generate.
  4. Run the flow. PDF4me returns Output Documents, an array with one generated document per data row.
  5. Add an Apply to each action over Output Documents to email, upload, or archive each generated document individually.

Which Data String Format Should I Use?

Use the array-of-arrays format, a header row followed by value rows, when the source data already comes out of Excel or a table-shaped connector as parallel arrays, since it maps directly onto rows and columns. Use the array-of-objects format when the source data comes from a system like a CRM or forms connector that naturally returns named fields per record, since each object's keys already line up with the template's merge field names.

Typical Setups

Workflow ExamplesCommon Power Automate flow patterns using Mail Merge with Data String List of Docs.
Bulk certificate generation
  1. A flow triggers when a training course is marked complete in the LMS.
  2. Get participant list retrieves every course completer with name and completion date.
  3. A Compose action builds the Data string as an array of name/course/date objects.
  4. Mail Merge with Data String generates one certificate per participant in a single call, and an Apply to each loop emails each certificate to its recipient.
Personalized offer letters
  1. A hiring manager approves a batch of candidates in the ATS, triggering the flow.
  2. Get candidate data retrieves name, role, and salary for each approved candidate.
  3. Mail Merge with Data String maps the offer letter template and generates one letter per candidate.
  4. The Output Documents array is sent to HR for review before individual delivery.
Scheduled account notices
  1. A recurrence trigger runs a monthly billing-notice flow.
  2. Get customer data queries the billing system for every account due a notice that month.
  3. Mail Merge with Data String generates a personalized notice per account from a single notice template.
  4. An Apply to each loop uploads each notice to the customer's SharePoint folder and sends a summary email.

Practical Tips

Match merge field names to Data string keys exactly
The template's merge fields must line up with the Data string's column headers or object keys, character for character, or those fields render blank in the output.
Pick one Data string shape and stick with it
Mixing array-of-arrays and array-of-objects rows in the same request is not supported. Choose whichever shape your upstream data source already produces to avoid an extra transform step.
Use Compose to build the Data string before the action
Building the JSON array in a Compose action makes it easy to inspect and debug the exact payload before it reaches Mail Merge with Data String.
Always follow with Apply to each
Output Documents is an array by design, so downstream email, SharePoint, or archive steps need an Apply to each loop rather than a single-item reference.
Keep the template in the same PDF4me account you authenticate with
A template that renders correctly when tested manually can still fail from a flow if the connection used to run the flow points at a different PDF4me account than the one that owns the template file.

Cheat Sheet

FieldValue
ActionMail Merge with Data String List of Docs
Template File Data.docx or .pdf, mapped from a prior action
Template File Namee.g. LetterTemplate.docx
Data stringArray-of-arrays (header + rows) or array-of-objects
Documents generatedOne per data row/object
OutputOutput Documents array, each with File Content + File Name
Next stepApply to each over Output Documents

Common Questions

How do I generate multiple documents from one template in Power Automate?+
Add the PDF4me Mail Merge with Data String List of Docs action, map Template File Data and Template File Name from a Word or PDF template containing merge fields, then build the Data string as a JSON array with one entry per document. The action returns Output Documents, an array ready for an Apply to each loop.
What format does the Data string need?+
Data string accepts two JSON shapes: an array-of-arrays with a header row followed by value rows, for example [["Name","Email"],["John","[email protected]"]], or an array of field/value objects. Each additional row or object after the header produces one generated document.
Can the template be a PDF instead of a Word document?+
Yes. Template File Data accepts both .docx and .pdf templates, as long as the template contains the merge fields referenced by the Data string's column or field names.
How do I process each generated document afterward?+
Feed the action's Output Documents array into an Apply to each control. Inside the loop, each item exposes its own File Content and File Name, which can be emailed, uploaded to SharePoint, or zipped into an archive. See <a href="https://learn.microsoft.com/en-us/power-automate/apply-to-each" target="_blank" rel="noopener noreferrer">Microsoft's Apply to each documentation</a> for loop configuration details.
Is there a single-document version of this action?+
Yes. For a one-template, one-record merge, use the PDF4me Generate Document Single action, linked under Related Actions below. See <a href="https://learn.microsoft.com/en-us/connectors/pdf4meconnect/" target="_blank" rel="noopener noreferrer">the PDF4me Power Automate connector reference</a> for the full action list.

Industry Use Cases & Applications

Human Resources & Payroll Use Cases

  • Offer Letters: Generate personalized employment offers for an entire hiring batch in one call
  • Onboarding Documents: Create new-hire paperwork for all incoming employees at once
  • Performance Reviews: Generate review documents for all staff from a single review cycle
  • Benefits Statements: Create personalized benefits summaries for open enrollment

Same Task on Other Platforms

Get Help