Google Sheets Row to Document and Email
When a Google Sheet row is marked Ready, the flow merges its values into a Word/PDF template (quote, certificate, letter), stores the PDF in OneDrive/SharePoint, emails it to the contact in the row, and writes the sent status and link back. Turns sheet rows into delivered documents automatically.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow turns Google Sheets rows into delivered PDF documents. On a schedule it reads every row from a worksheet, and for each row whose Status = Ready it merges the row values into a Word template, converts the result to PDF, stores both files in SharePoint, emails the PDF to the contact on the row, and writes Status = Sent plus the document link back to the same row.
Why it matters: Copying row data into documents and emailing them by hand is slow and error-prone. A template merge plus auto-send produces consistent documents (quotes, certificates, letters) and leaves an auditable delivery record in the sheet itself.
Build: Solution FlowLibs - Google Sheets Row to Document and Email. Flow state Off (demo). Flow Checker 0 errors / 1 warning (the warning is the intentional "flow is off").
Use Case
A sales/operations team keeps recipient data (contact name, email, and document fields) in a Google Sheet. When a coordinator flags a row Ready, they want a personalized document generated from a standard template and emailed automatically, with the row updated so it is not processed twice. Examples: customer quotes, completion certificates, welcome letters.
Flow Architecture
Recurrence
Recurrence (Day / 1)Runs on a schedule to pick up Ready rows.
Initialize variables
Initialize Variable (String)Configurable values: Ready/Sent status labels, the Status / Email / Contact Name / Document Link column names, and the email subject.
Get Spreadsheet Rows
Google Sheets GetItemsReads all rows from the configured worksheet.
Apply To Each Row
Foreach (concurrency 1)Loops over every returned row.
Check If Row Is Ready
Condition (If)Processes only rows where Status = Ready (False branch = 0 actions).
Compose Template Field Data
ComposeBuilds the field/value object merged into the template.
Populate Word Template
Word CreateFileItemMerges row values into the Word template, producing a populated .docx.
Save Populated Word Document
SharePoint CreateFileStores the .docx in the output folder.
Convert Document To PDF
Word GetFilePDFConverts the stored .docx to PDF.
Save PDF Document
SharePoint CreateFileStores the PDF and returns its link/path.
Send Document Email
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GSheetSpreadsheetId | String | <configure> | Google Sheets file (spreadsheet) ID to read. |
| flowlibs_GSheetWorksheetName | String | Sheet1 | Worksheet / tab name. |
| flowlibs_WordTemplateSource | String | https://your-tenant.sharepoint.com | Word Online source/site hosting the template. |
| flowlibs_WordTemplateDrive | String | <configure> | Document library / drive ID (b!...) of the template. |
| flowlibs_WordTemplateFile | String | <configure> | The .docx template file ID (content controls). |
| flowlibs_DocOutputSiteUrl | String | https://your-tenant.sharepoint.com | SharePoint site for storing generated files. |
| flowlibs_DocOutputFolderPath | String | /Shared Documents/Generated | Server-relative output folder path. |
| flowlibs_DocOutputDrive | String | <configure> | Drive ID (b!...) of the output library, used by the PDF conversion. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Google Sheets | shared_googlesheet | GetItems PatchItem |
| SharePoint | shared_sharepointonline | CreateFile |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Per-document-type templates
- Read a Document Type column and switch flowlibs_WordTemplateFile (or add a Switch) to merge different templates per row.
- Trigger style
- Swap the Recurrence trigger for a tighter schedule, or keep the short-poll and add a last-processed column for idempotency.
- CC / BCC a sales rep
- Add emailMessage/Cc to Send_Document_Email.
- Different storage
- Point the SharePoint CreateFile actions at OneDrive (shared_onedriveforbusiness CreateFile) if preferred; update the Word source/drive env vars to match.
- Richer merge fields
- Extend Compose_Template_Field_Data with more row columns; add matching content controls to the Word template.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Status check (If)
Processes only rows whose Status equals the configured Ready value.
EXPR.02Dynamic column read
Reads a row cell whose header is supplied by a variable.
EXPR.03Template merge payload
Whole-object expression for dynamicFileSchema, keeps the dynamic-schema action clean in Flow Checker.
EXPR.04PDF for email/convert
The converted PDF body used for the email attachment.
EXPR.05Write-back (preserve other columns)
Sets Status = Sent and the document link while preserving other columns.
EXPR.06Row key for PatchItem
The sheet row key used to target the write-back.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.