如何使用Power Automate在线刷新Excel Power查询?
我将数据从SharePoint列表中删除到Excel文件,并且我正在尝试在线使用Power Automate来创建一个计划的流,该流程将触发Excel中的Power Query的“刷新所有”按钮(请参阅图像)。由于不同的保护,我无法简单地在Excel中直接安排刷新,而Power Automate则无法以所需的格式提取SharePoint列表。 Power Automate Online似乎没有一个可以连接到Excel中的Power查询的选项。有什么建议吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Power Automate没有功能可以允许您刷新连接或打开/关闭文档。我还遇到了文档的问题,因为它是另一个用户锁定的(由于使用了一个驱动器)。我也无法使用Power BI,脚本或宏。
我需要工作流程以将行添加到电子表格,更新枢轴表,然后发送带有结果的电子邮件。这是我在不更新的枢轴表中所做的。
在Excel中:
刷新数据
更新列
*每当您在文档中手动进行更改时,请确保通过将其更改为“查看”来“关闭”会话,否则由于文档被锁定而无法正确完成。
查看
在Power Automate中:我将触发器设置为本月底的时间表,但是您的触发器或时间表和参数可以是您将它们设置为的任何内容。我将向您展示对电子表格重要的步骤。
*工作流快照:
workflow快照
添加一行
延迟1:10分钟。这使一个开车时间可以关闭并结束当前会话。
更新一行:选择文件的位置(这是我们创建的表,并隐藏着之前)。
更新行
延迟2:2分钟
获取文件内容(一个驱动器)>选择文件。我仅限于只能看到我的个人驱动器,因此请确保您的Excel工作簿保存在可以在Power Automate中选择的位置。
转换文件(一个驱动器)>选择文件。 
转换文件
发送电子邮件>附件名称:(文件名=输出('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:
Refresh Data
Updated Column
*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
Add A Row
Delay 1: 10 minutes. This allows One Drive time to close and end the current session.
Update a row: Select the location of the file (this is the table we created and hid earlier).
Update Row
Delay 2: 2 Minutes
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.
Convert file (One Drive)> Select the file.
Convert File
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
如果有一种方法可以从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