如何使用Power Automate在线刷新Excel Power查询?

发布于 2025-02-05 11:40:00 字数 344 浏览 3 评论 0 原文

我将数据从SharePoint列表中删除到Excel文件,并且我正在尝试在线使用Power Automate来创建一个计划的流,该流程将触发Excel中的Power Query的“刷新所有”按钮(请参阅图像)。由于不同的保护,我无法简单地在Excel中直接安排刷新,而Power Automate则无法以所需的格式提取SharePoint列表。 Power Automate Online似乎没有一个可以连接到Excel中的Power查询的选项。有什么建议吗?

电源查询按钮

I have data being pulled from a SharePoint list to an Excel file and I'm trying to use Power Automate online to create a scheduled flow that will trigger the "Refresh All" button for Power Query in Excel (see image). Due to different protections, I'm unable to simply schedule the refresh directly in Power Query in Excel and Power Automate cannot pull the SharePoint list in the format I need. There doesn't seem to be an option in Power Automate online that would connect to Power Query in Excel. Any suggestions?

Power Query Button

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伴我心暖 2025-02-12 11:40:00

Power Automate没有功能可以允许您刷新连接或打开/关闭文档。我还遇到了文档的问题,因为它是另一个用户锁定的(由于使用了一个驱动器)。我也无法使用Power BI,脚本或宏。

我需要工作流程以将行添加到电子表格,更新枢轴表,然后发送带有结果的电子邮件。这是我在不更新的枢轴表中所做的。

在Excel中:

  1. 打开枢轴表选项,然后选择“刷新文件打开”。
    刷新数据
  2. 在工作表上使用枢轴表(s)创建一个单元格中的表格,具有与下面的类似信息(在工作流中,我们将更新此表,以便迫使系统重新打开文档并刷新)。创建表后,选择列和“隐藏列”。
    更新列
  3. 如果您像我一样使用一个驱动器或共享文档,那么您需要的所有更改,您都需要将会话更改为“查看”,然后关闭文档。 

*每当您在文档中手动进行更改时,请确保通过将其更改为“查看”来“关闭”会话,否则由于文档被锁定而无法正确完成。
查看
在Power Automate中:我将触发器设置为本月底的时间表,但是您的触发器或时间表和参数可以是您将它们设置为的任何内容。我将向您展示对电子表格重要的步骤。

*工作流快照:
workflow快照

  1. 选择文件位置和表格>从SharePoint列表中更新所有字段(value = outputs('get_items')?['body/value']。
  • 我使用此步骤自动更新电子表格,并将添加到SharePoint列表中的项目自动更新(可以将其提取到一个每月报告)。
    添加一行
  1. 延迟1:10分钟。这使一个开车时间可以关闭并结束当前会话。

  2. 更新一行:选择文件的位置(这是我们创建的表,并隐藏着之前)。
    更新行

  3. 延迟2:2分钟

  4. 获取文件内容(一个驱动器)>选择文件。我仅限于只能看到我的个人驱动器,因此请确保您的Excel工作簿保存在可以在Power Automate中选择的位置。

  5. 转换文件(一个驱动器)>选择文件。 
    转换文件

  6. 发送电子邮件>附件名称:(文件名=输出('convert_file')>附件内容:( body = outputs('convert_file')。它可以在“转换的文件”部分中列为“文件内容”。
    发送电子邮件

Power Automate doesn't have a feature to allow you to refresh connections or open/close a document. I was also encountering the issue of the document not refreshing on "open" because it was locked by another user (due to using One Drive). I couldn't use Power BI, scripts, or MACROS either.

I needed my workflow to add rows to a spreadsheet, update the pivot tables, and then send an email with the results. Here is what I did to get around the pivot tables not updating.

In Excel:

  1. Open the pivot table options and select "Refresh data on file open".
    Refresh Data
  2. On the worksheet with your pivot table(s), create a table in a cell that has similar information as below (in the workflow we will update this table so it forces the system to re-open the document and refresh). Once the table is created, select the column and "Hide columns".
    Updated Column
  3. If you are using One Drive or a shared document like I did, when you have made all the changes you need, you will want to change the session to "viewing", and then close the document. 

*Any time you make changes manually in the document, make sure to "close" the session by changing it to "viewing" or else the workflow will not complete properly due to the doc being locked.
Viewing
In Power Automate: I have my trigger set to a schedule at the end of the month but your trigger or schedule and parameters can be whatever you set them as. I'm going to show you the steps that are important to the spreadsheet.

*Workflow snapshot:
Workflow Snapshot

  1. Add a row into a table > Select the file location and the table > Update all the fields from the SharePoint list (Value= outputs('Get_items')?['body/value'].
  • I used this step to update the spreadsheet automatically with items added to a SharePoint list (so it can be extracted into a report monthly).
    Add A Row
  1. Delay 1: 10 minutes. This allows One Drive time to close and end the current session.

  2. Update a row: Select the location of the file (this is the table we created and hid earlier).
    Update Row

  3. Delay 2: 2 Minutes

  4. Get file content (One Drive) > Select the file. I was limited to only being able to see my individual One Drive so make sure your excel workbook is saved in a location you can select in Power Automate.

  5. Convert file (One Drive)> Select the file.
    Convert File

  6. Send an email > Attachment Name: (File Name= outputs('Convert_file') > Attachment Content: (Body= outputs('Convert_file'). It may be listed as "File content" in the Converted File section.
    Send Email

无所谓啦 2025-02-12 11:40:00

如果有一种方法可以从Power Automate刷新功率查询,或者您可以使用与Power Automate连接的Power BI,则可能会有一个更简单的选项。

但是,功率自动化的数据流也可以类似于Power查询。
https://youtu.be/8ivhxrnwj7q

然后,您可以在Power Automate Automate&Amp&使用Excel批处理操作导入所有数据以从流量中出色。

There may be a simpler option if there is a way to refresh power query from Power Automate, or if you could use Power BI which is connected to Power Automate.

But there is also dataflows in Power Automate that can work similar to power query.
https://youtu.be/8IvHxRnwJ7Q

Then you can do any additional transformations in Power Automate & use Excel batch actions to import all the data to Excel from a flow.
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Excel-Batch-Create-Update-and-Upsert/td-p/1624706

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文