I'm trying to automate the export of a Power Bi query onto a specific Excel document. 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.
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.
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.
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.
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.
My big issue is that I can't find a good way to use a right mouse click within 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.
I'm looking for some way to get that table copied or exported to 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.
The first parameter of the MouseClick command in AutoIt specifies the mouse button that is supposed to be clicked:
MouseClick("right", 500, 500)
... will perform a click with the right mouse button at 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:
Invoke-AU3MouseClick -Button "right"
Related
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
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:
Open the pivot table options and select "Refresh data on file open".
Refresh Data
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
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
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
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
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
I got an excel file, created by ex-colleagues.
Excel file has data connection link to some where to pull out the data, how to know the actual path for the source? I only see it linked to Data Source=Workbook;
What is the actual path for the Workbook?
Here is the exported data:
<odc:PowerQueryConnection odc:Type="OLEDB">
<odc:ConnectionString>Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=TBL_Data (2);Extended Properties=""</odc:ConnectionString>
<odc:CommandType>SQL</odc:CommandType>
<odc:CommandText>SELECT * FROM [TBL_Data (2)]</odc:CommandText>
</odc:PowerQueryConnection>
This connection uses PowerQuery. To get the underlying Server/Database hit the Queries & Connections button on the Data tab of the ribbon and hover your mouse over the connection on the right.
Sometimes PowerQueries use data from other queries so the source won't be apparent unless you right click -> Edit the connection. On the right of the Power Query editor you'll see the ETL steps your data has taken. If you hit the Advanced Editor button on the Home tab you can see this described in Power Query Formula Language.
Hi I am planning to make a pivot table using UIpath.
Is there a way to make a pivot using UIpath? anyone have experienced on this?
what function to use?
Can you provide more information about what you are trying to do?
I'd suggest you are going to have to create an empty Excel workbook first and then add a VBA macro to it that will create a pivot table.
You can then use UIPath to pull in the raw data into the workbook and execute the macro to actually create the pivot table.
there are two ways of doing in
Macro. Record macro and use "Execute macro" activity in the uipath program
UI Automation
select the data to make pivot using 'select range' activity.
using send hotkey, pass Alt+NVT (Will open the pivot dialog box)
select the row,column etc using find element or find image and drag and drop to required fields (Drag and drop can be done by using a combination of'click up' and 'click down' property in click activity
3 ways
1)Macro
2)Ui Automation
3)Launch the excel using uipath and use send hotkeys to trigger excel shortcuts for Pivot Table Creation
I came across web queries option in excel just an hour ago, so please pardon my naivety.
I am trying to pull a table from this page on BLS, however I am getting only first part of the table whereas I need only the second part of the table (or the full table). I am trying to import the part with historical data just below download xlsx button. It is part of the table which starts from "Series Id: CES2000000001" and ends at "P : preliminary". One thing I noticed that the table does not have any id, and excel reads its name as "3"
The table is not in a good format for excel "from web" in the data tab from my test. However, if you download Microsoft's Excel Power Query Add-in (or use Excel 2016) then I found that it detects the table correctly.
After downloading powery query, simply go to the 'Power Query' tab instead of 'data' and select 'from web' and enter the website. You'll get a screen like below.
Please note however, if this is a one time deal you can simply select the HTML table by dragging over it with your mouse, copy it, and paste it directly into excel.
I need to send Sales Report to my colleagues on the end of every week and I pull the same details from SAP (Stockwarehouse Russia). My question is, everytime I need to do the same steps again and again in Excel i.e. editing and deleting the same columns, applying filters, assigning the right description for the exact same fields, Movement Type etc. And it becomes very monotonous and pathetically time consuming.
So is there a way where I can record the steps I performed and store is somewhere on the HDD so that next time I can simply open Excel, run the program and report would be generated automatically?
What you will need to do is record a Macro
http://office.microsoft.com/en-gb/excel-help/create-or-delete-a-macro-HP010342374.aspx
http://www.dummies.com/how-to/content/how-to-record-a-macro-to-automate-tasks-in-excel-2.html
First 2 links in a Google search...
If you are using Excel 2013. I would higly recommend to use Microsoft Power Query AddIn (PQ). With PQ you can easily connect to SAP, than create some transformation with your data and save this as a "script". WHenever you open this worksheet you will have a fresh data. The adventage is that you don't need to use any piece of code and you can save your operation in few minutes.
Later if you will want to automate this operation you can write simple script (avaliable on the net) to refresh the worksheet and just add the code to send somewhere or if you have a SharePoint you can easily share with your worksheet with Power Query script into the SharePoint and everybody should have acces to your transormed data.
Please check: http://www.microsoft.com/en-us/powerBI/SAP.aspx#fbid=OjGdeZslbeu