简体   繁体   English

自动将数据从Power Bi导出到Excel

[英]Automating export of data from Power Bi to Excel

I'm trying to automate the export of a Power Bi query onto a specific Excel document. 我正在尝试自动将Power Bi查询导出到特定的Excel文档中。 My company is constantly running a manual report to update this Excel file and we're trying to set a level of automation to the task to save company time. 我的公司一直在运行手动报告来更新此Excel文件,并且我们正在尝试为任务设置自动化级别以节省公司时间。

So far I've managed to fully automate the Power Bi query to the point where my PowerShell opens Power Bi, edits the query and runs the API call. 到目前为止,我已经设法完全自动化Power Bi查询,直到我的PowerShell打开Power Bi,编辑查询并运行API调用为止。 At this point I'm attempting to copy the table from Power Bi to Excel and I've found a solution but I can't figure out how to automate some parts of the solution onto my Power Shell script. 此时,我试图将表格从Power Bi复制到Excel,并且找到了解决方案,但是我不知道如何在我的Power Shell脚本上自动化解决方案的某些部分。

Apparently the easiest way to copy the table over is to be in Power Bi and click from the report tab onto the data tab. 显然,复制表格最简单的方法是在Power Bi中,然后从“报告”选项卡单击到“数据”选项卡。 Then right click anywhere on the table containing the data and select 'copy table' Once the table is copied the solution is as easy as going to the excel file then using a select all and paste it would replace the existing data, and my job is done. 然后右键单击包含数据的表上的任意位置,然后选择“复制表”。复制表后,解决方案就像转到excel文件一样简单,然后使用全选并粘贴它将替换现有数据,而我的工作是完成。

My big issue is that I can't find a good way to use a right mouse click within PowerShell. 我的大问题是,找不到在PowerShell中使用鼠标右键单击的好方法。 For the left mouse I've been using autoit but when I consulted their documentation they don't appear to have a right mouse command. 对于左鼠标,我一直在使用autoit,但是当我查阅其文档时,它们似乎没有鼠标右键。

I'm looking for some way to get that table copied or exported to excel. 我正在寻找某种方法来将该表复制或导出到excel。 Either through a series of keyboard shortcuts that can be replicated in PowerShell, or an explanation of how to use right click through PowerShell so that I can access that copy table command. 通过可以在PowerShell中复制的一系列键盘快捷键,或者说明如何通过PowerShell使用右键单击,以便我可以访问该复制表命令。

The first parameter of the MouseClick command in AutoIt specifies the mouse button that is supposed to be clicked: AutoIt中MouseClick命令的第一个参数指定应该单击的鼠标按钮:

MouseClick("right", 500, 500)

... will perform a click with the right mouse button at 500|500 . ...将在500|500处单击鼠标右键。 The reference for this function specifies even more options. 此功能参考指定了更多选项。

Unfortunately I have never used AutoIt via Powershell, but after looking at some examples I think that you could call it this way: 不幸的是,我从未通过Powershell使用过AutoIt,但是在查看了一些示例后,我认为您可以这样称呼它:

Invoke-AU3MouseClick -Button "right"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM