为 Excel Online 表或 SharePoint 列表中的每一行导出一个分页报表

借助 Power Automate,Power BI 分页报表可自动导出并分发到各种支持的格式和方案。 本文将使用 Power Automate 模板自动设置单个或多个分页报表的定期导出。 对于 Excel Online 表或 SharePoint Online 列表中的每一行,可以采用所需格式将它们导出。 你可将导出的分页报表分发到 OneDrive 工作版或学校版或 SharePoint Online 站点,或者通过 Office 365 Outlook 向其发送电子邮件。

Screenshot that shows how to export a paginated report by using an Excel Online table.

Excel Online 表或 SharePoint Online 列表中的每一行都可以表示单个用户,用户可基于订阅接收分页报表。 或者,每一行都可以表示要分发的唯一分页报表。 表或列表需要一列来指定如何分发报表,无论是 OneDrive、SharePoint Online 还是 Outlook。 Power Automate 流在其 Switch 语句中使用此列。

正在寻找用于 Power BI 分页报表的其他 Power Automate 模板? 请参阅使用 Power Automate 导出 Power BI 分页报表

先决条件

要继续操作,请确保满足以下条件:

  • 可以发布到“我的工作区”,或者至少具有任何其他工作区的参与者角色
  • 有权访问 Power Automate 中的标准连接器,这些连接器随任何 Office 365 订阅一起提供。
  • 如果使用的是 Excel Online 表,则需要将其格式化为 Excel 表。 请参阅创建表了解操作方法。

为表或列表中的每一行导出一个分页报表

注意

以下步骤和图像将演示如何使用“为 Excel Online 表中的每一行导出 Power BI 分页报表”模板来设置流。 可使用“为 SharePoint Online 列表中的项导出 Power BI 分页报表”模板按照相同的步骤创建流。 SharePoint Online 列表(而非 Excel Online 表)将包含有关如何导出分页报表的信息。

  1. 登录 Power Automate flow.microsoft.com

  2. 选择“模板”,然后搜索“分页报表”。

    Screenshot of Power Automate templates for Power BI paginated reports.

  3. 选择“为 Excel Online 表中的每一行导出 Power BI 分页报表”或“为 SharePoint Online 列表中的项导出 Power BI 分页报表”模板 。 请确保你已登录 Excel Online、Power BI、OneDrive 工作版或学校版、SharePoint Online 和 Office 365 Outlook。 选择“继续”。

    Screenshot that shows the applications that the selected flow connects to.

  4. 若要为流设置“重复周期”,请在“频率”中选择一个选项,并输入所需的“间隔”值 。

    Screenshot that shows where to select recurrence for your flow.

  5. (可选)选择“显示高级选项”以设置特定的“重复周期”参数,包括“时区”、“开始时间”、“天”、“小时”、“分钟”。

    Screenshot that shows the option to select advanced recurrence options.

  6. 在“位置”框中,选择保存 Excel Online 表或 SharePoint Online 列表的 OneDrive 工作版或学校版或 SharePoint Online 站点。 然后从下拉列表中选择“文档库”。

    Screenshot that shows where to select the location of the Excel Online table.

  7. 在“文件”框中选择 Excel Online 文件或 SharePoint Online 列表。 从“表”框的下拉列表中选择表或列表的名称。

    Select the Excel Online file and name of the table.

    提示

    请参阅创建表,了解如何将数据格式化为 Excel 表。

  8. 初始化要用于文件名的变量。 可保留或修改“名称”和“值”的默认值,但将“类型”值保留为“字符串”。

    Screenshot that shows the Default output file name dialog box.

  9. 在“工作区”框中,选择预留容量中的工作区。 在“报表”框中,选择所选工作区中要导出的分页报表。 如果从下拉列表中设置“输入自定义值”,可将“工作区”和“报表”设置为等于 Excel Online 表或 SharePoint Online 列表中的列。 这些列应分别包含工作区 ID 和报表 ID。

  10. 从下拉列表中选择“导出格式”,或将其设置为包含所需导出格式的 Excel Online 表中的列。 例如 PDF、DOCX 或 PPTX。 也可以为分页报表指定参数。 有关参数的详细说明,请查看 Power BI REST API 的连接器参考

    Screenshot that shows the Export to File for Paginated Reports dialog box.

  11. 导出分页报表后,在“值”框中输入名称。 请务必输入文件扩展名。 可以静态设置扩展名,如 .pdf.docx.pptx。 也可以通过在 Excel 表中选择与所需导出格式相对应的列,来动态设置扩展名。

    Screenshot that shows where to select the name of the report and a file extension.

  12. 在“Switch”部分,用 Excel Online 表中与所需传递方法对应的列填充“On”框:OneDrive、SharePoint 或电子邮件。

    Screenshot that shows the Switch section where you populate the On box with the column in your Excel Online table.

  13. 在“案例”、“案例 2”和“案例 3”部分,输入上一步中选择的 Excel Online 表列中显示的值。

    Screenshot that shows where to enter values for Case, Case 2, and Case 3.

  14. 在要将分页报表保存到 OneDrive 的案例中,请选择保存位置的“文件夹路径”。

    Screenshot that shows the case where you're saving to OneDrive.

  15. 如果要将分页报表保存到 SharePoint Online,请输入保存位置的“站点地址”和“文件夹路径” 。

    Screenshot that shows the case where you're saving your paginated report to SharePoint Online.

  16. 如果要通过 Outlook 以电子邮件的方式发送分页报表,请填充“收件人”、“主题”和“正文”框 。 这些框可以包含静态内容,也可包含来自 Excel Online 表或 SharePoint Online 列表的动态内容。 Power Automate 会将分页报表自动附加到此电子邮件。

    Screenshot that shows the case where you're sending your paginated report as an email via Outlook.

  17. 完成后,选择“新步骤”或“保存”。 Power Automate 会创建和评估流,并告知你是否找到错误。

  18. 如果有错误,请选择“编辑流”以修复错误。 如果没有,请选择“后退”箭头来查看流的详细信息,并运行新流。