跳到主要内容

Excel 填充 Power Automate

此操作的作用

PDF4me Excel - 填充 合并 JSON 有效载荷进入 Excel 包含的模板 Aspose 智能标记 字段并返回一个填充的内容 .xlsx 准备附加、存储或发送。映射模板 SharePointOneDrive或者 Dataverse,粘贴或构建 JSON 从动态内容中提取信息,并将填充后的工作簿通过管道传输到 SharePoint 创建文件Outlook 发送电子邮件OneDrive 创建文件Dataverse 添加新行, 或者 团队发布消息.多工作表工作簿、公式重新计算和区域设置相关的数字/日期格式设置均可通过一次操作完成。

相关博客文章(1)

执行此操作之前: 作者 Excel 带有智能标记字段的模板,例如 &=Items.ItemName完整的语法(修饰语、多页布局、嵌套) JSON 路径、公式处理、文化格式化)以及可下载的示例模板和 JSON 有效载荷在 Excel 填充模板语法 参考页。

验证您的身份 API 要求

PDF4me 将连接器连接到 Power Automate 需要有效 联系 握着你的 PDF4me API 关键在于:在流程设计时创建一次连接,然后每次都创建连接。 PDF4me 租户中的操作会重用它。

您不容错过的重要事实

JSON 数据键必须与标记数据源名称匹配
标记 &=Items.ItemName 需要 JSON 包含一个 项目 包含一个对象的数组 物品名称 属性。字段名称区分大小写(物品名称 不匹配 物品名称)。
工作表索引从 1 开始,以逗号分隔。
将工作表索引留空,以便填充每个工作表。 2 仅填充第二个工作表,或者 1,3 用于填充第一页和第三页。适用于多工作表模板,其中一个上游系统仅拥有工作簿的一部分。
公式默认重新计算。
计算公式默认值为 是的 因此,收件人打开文件时,总计、求和以及相关单元格的数据都是准确的。设置为 如果您想重新计算下游参数并节省时间。
在 Power Automate 中使用 Excel 的“填充”操作。文件内容映射自 SharePoint 的“获取文件内容”步骤。JSON 数据显示一个包含三条记录(A123、B456 和 C789)的 Items 数组,每条记录包含 ItemName、Qty 和 UnitPrice 属性。文件名是 Populate.xlsx。工作表索引为 2。

Excel - 填充在 a 中配置的操作 Power Automate 从映射的文件流 SharePoint一个内联 JSON 项目数组和工作表索引将合并限制在工作表 2 中。

参数

必需的: 文件内容, JSON 数据。 受到推崇的: 文件名(默认为) 填充.xlsx)以及当模板包含多个工作表时的工作表索引。 先进的: 严格的 JSON 字符串、文化和语言设置、计算公式、引用前缀样式。

范围必需的它的作用例子
File ContentYesExcel template (.xlsx) as binary dynamic content from a prior step: SharePoint Get file content, OneDrive Get file content, Dataverse Download file, Outlook Get attachments. The template must contain Smart Marker cells.@triggerOutputs()?['body']
File NameNoTemplate filename including .xlsx extension. Defaults to Populate.xlsx. Used for tracking and as the basis for Output File Name.Populate.xlsx
JSON DataYesJSON object whose top-level keys match the data source names in your markers. May be pasted inline, built from a Compose step, or mapped from a Parse JSON / HTTP step.{"Items":[{"ItemName":"A123","Qty":"55","UnitPrice":"3.05"}]}
Worksheet IndexesNoComma-separated 1-based sheet indexes to populate. Empty = all sheets. Pass 2 for sheet 2 only, 1,3 for sheets 1 and 3.2
Strict JSON StringsNoYes (default) preserves quoted JSON string primitives as text in the Excel cell. No coerces quoted numeric-looking strings into typed numeric values during merge.Yes
Culture & Language SettingsNoStandard culture name controlling number, date, and currency formatting written into cells. Defaults to en-US. Examples: fr-FR, de-DE, ja-JP.en-US
Calculate FormulasNoYes (default) recalculates the workbook after the merge so totals are accurate on open. No skips recalculation to save time when a downstream step will recalc.Yes
Quote Prefix To StyleNoApplies the Excel quote-prefix flag to styled values so cells that look numeric but should stay text (account numbers, ZIP codes with leading zeros) render as text.Yes
Excel“填充”操作的高级参数面板:严格 JSON 字符串 是,区域和语言设置 en-US,计算公式 是,引用前缀样式 是

高级参数面板 Excel - 填充暴露严格 JSON 字符串、文化和语言设置、计算公式和引用前缀样式。

输出

动态内容字段类型它包含什么
Output File ContentBinaryThe populated Excel workbook. Pass into SharePoint Create file, OneDrive Create file, Outlook Send an email with attachment, Dataverse Add a new row, or Teams Post a message with file.
Output File NameStringThe output filename, based on File Name with the .xlsx extension.
SuccessBooleantrue on successful population, false on failure. Use in a Condition step for retry / branching logic.
Error MessageStringShort error description on failure. Empty when Success is true.
Error Details ItemArrayItemised error messages when the engine encountered multiple issues. Empty when Success is true.
Excel - 填充动态内容选择器,显示输出文件内容、输出文件名、成功、错误消息和错误详细信息项

从 Excel 输出动态内容 - 填充操作,准备映射到下游 Microsoft 365 行动。

原始响应形状

供参考(或在调用底层时) REST 直接跳转到端点),成功后的操作主体如下所示:

来自 Excel - Populate 操作的原始 HTTP 响应。状态码 200,内容类型 application/json。响应正文包含一个文档字段,其中包含 Base64 编码的 XLSX 文件,文件名为 Populate.xlsx,成功状态为 true。

状态码 200,内容类型 application/json身体携带 文档Base64 XLSX), 文件名, 和 成功错误信息 以及 错误 数组仅在运行失败时存在。

快速试用(3分钟内即可完成)

以上截图对应的是两个可直接运行的组合。下载每对文件,将 XLSX 文件拖放到“文件内容”文件夹中,然后粘贴以下内容: JSON 进入 JSON 数据,然后运行。

组合A:简单项目(与参数截图相符)

用途 模板.xlsx工作表索引 = 2 (Sheet2 包含参数屏幕截图中使用的简单项目标记)。与配套的平面项目配对。 JSON

组合 B:包含丰富发票 Excel 桌子

使用发票单 模板.xlsx 嵌套 &=RootData.Items.* 标记物,结构化参考公式 简易发票 表格,小计+税+总计计算。

组合 C:多页工作簿

这是一个三页模板,每页展示不同的数据源。文件中的表格顺序是: 物品、员工、产品

流程示例

常见的 Power Automate 流程模式Typical ways to chain Excel - Populate into a flow.
SharePoint 列表到发票工作簿
  1. SharePoint 当订单列表中创建项目时,会触发事件。
  2. SharePoint 获取项目从订单行列表中提取匹配的行项目。
  3. Compose 构建 JSON 包含来自行项目的 Items 数组的数据有效负载。
  4. SharePoint 获取文件内容加载发票 Excel 模板。
  5. Excel - 填充合并模板 JSON
  6. Outlook 向客户发送一封包含输出文件内容的电子邮件附件。
每月定期盘点报告
  1. 重复触发条件为每月1日09:00。
  2. Dataverse List 行提取当前库存。
  3. 组合操作会将结果塑造成…… JSON 包含 Products 数组的对象。
  4. SharePoint 获取文件内容会加载 3 页模板。
  5. Excel - 将工作表索引设置为 2 填充到运行中(仅限产品工作表)。
  6. OneDrive 创建文件存档报告;Teams 发布消息时会添加指向该文件的链接。
表格回复员工名册
  1. Microsoft Forms 当提交新回复时,触发器会触发。
  2. Dataverse List 行提取相关的员工和部门。
  3. Compose 构建 JSON 包含员工数组的数据。
  4. Excel - 将合并数据填充到 HR 名册模板中,文化设置为表单响应中的区域设置。
  5. Outlook 发送电子邮件会将填写好的工作簿发送给人力资源经理。

常见问题解答

What is the JSON Data field expected to contain?+
A JSON object whose top-level keys match the data source names used in the Smart Markers of your Excel template. For markers like &=Items.ItemName, the JSON must contain an Items array of objects with an ItemName field. Field names are case sensitive.
What syntax do the cells in the Excel template use?+
Aspose Smart Markers. Cells use &=DataSource.FieldName as the marker. Optional modifiers in parentheses control layout: (dynamic), (horizontal), (noadd), (skip:N), (copystyle), (shift), (repeat). See the Excel Populate Template Syntax page for the full grammar with examples.
What does Worksheet Indexes do?+
Restricts the merge to specific sheets. The value is comma-separated 1-based sheet indexes (for example 1,3 to populate the first and third sheet). Leave it empty to populate every sheet in the workbook.
Does Excel Populate recalculate formulas?+
Yes by default. Calculate Formulas is Yes by default so the workbook arrives with totals and aggregates already accurate. Set it to No when you intend to recalculate later in your own pipeline and want to skip the cost.
What does Strict JSON Strings do?+
Yes (default) preserves quoted JSON string primitives as text in the Excel cell. Set No to coerce quoted numeric-looking strings into typed numeric values during the merge. Use the default unless you have a specific reason to convert string primitives.
My template has a sheet I do not want populated. How do I exclude it?+
Use Worksheet Indexes. If your workbook has sheets in order Cover, Data, Notes (indexes 1, 2, 3) and you only want Data populated, pass 2. Cover and Notes stay untouched.
How big can the JSON payload be?+
Practical limits are bounded by the Power Automate action body size cap plus Excel cell limits. For larger payloads, write the JSON to a SharePoint or OneDrive file and reference it via a custom dispatcher pattern, or split the work into one call per sheet using Worksheet Indexes.
Does this work in Power Automate Desktop?+
PDF4me Connect is a cloud connector available in Power Automate (the web flow designer). For Power Automate Desktop, call the Excel Populate REST endpoint with the HTTP action.

相关行动

获取帮助