Excel 365 Data connection Data Source=$Workbook$ - excel

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.

Related

How can I write back to source excel files when I get Excel data from data tab?

So, I want to create one Excel file each for every manager with only one single sheet and place it on OneDrive.
In order to get the data in one place, I am creating another excel file called combined.xlsx.
Now, I can export each workbook to a tab using Data -> Get Data -> From File -> From Workbook .
This is great so far. So, I can read data of 10 excelfiles on 10 sheets in combined.xlsx.
Now, I want to modify contents of one of the tabs and make sure it is reflected to the original file. How can I do this?
To elaborate on why it is not possible, you need to understand how Power Query deals with data:
You load your data into Power Query via the "Data" tab. The source can be anything Microsoft allows.
You then manipulate the data any which way in Power Query.
As a last step, you decide if and where to load the results. If you only want to create a connection to the query, you select "Close and Load to", which appears after you click on the arrow next to "Close and Load", and you pick that. Otherwise, the only other options are loading the query results to a table, PivotTable report, PivotChart.
Because the output sheets you have are connected to the query that produced them, any time you refresh the query, whatever manual changes you have made in the table that the query created originally will be wiped out and overwritten with the refreshed data.
If you were able to write back to the source here, you'd in effect
create a circular reference.
Check out this article about having Power Query output your data after manipulating it, maybe it helps.

Can I use a database built in SharePoint for data validation in an Excel spreadsheet?

I have a dataset that is being built in SharePoint that contains data including job codes, dates, descriptions, and other variables. I want to limit data entry in an Excel spreadsheet to only values in the SharePoint dataset. Possible? Well I know it's possible.. but HOW?!
You can export the SharePoint list into Excel. Click the Export to Excel command in the SharePoint list.
That will download or open a query file. If it only downloads, double click to open the file with Excel. Enable data connections when prompted.
Confirm that the data should be loaded into a new workbook, or, if you already have a prepared file open, use that and load the data into a new worksheet.
When you do that, a dynamic data connection is created. This data connection can be configured to refresh each time the workbook is opened. Data Ribbon > Queries & Connections > Right click the query in the query panel > Properties
You can then use the query data for the data validation.

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. 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"

Power Query/ Excel - automated query refresh

I have introduced several Excel files in the company, which use Power Query to consolidate different Excel files and prepare them accordingly. The structure is as follows:
1st file:
- Query from Access
- Querys from 3 Excel files
2.-5.Datei:
Various Excel files.
Some of these files are updated daily with new records.
That means I have to daily in the excel files with the queries and these update.
Is it possible to outsource this somehow?
Sharepoint, server?
What ideas do you have?
Except a VBA macro which opens and refreshes the data accordingly?
Best regards
If you have one file with Power Query that get data from multiple files with daily refreshed data without any Power Query in them then:
In file with Power Query when you add result of Power Query to sheet you will get connection.
You can customize this connection to refresh on workbook opening or every N minutes.
Is this is what you want ?
Here:
http://www.excel2013.info/power-query/automatic-update/
you can see in "Refresh the connection" section how to customize connection.
Refresh the connection
Because your data is in a table, your table is link to your source of data. When you will receive a new csv file with the same name, in the same folder, you just have to refresh the query to update your workbook or you can refresh automatically your table when you open your workbook. To do that, you have go to the menu Data > Connections
In the dialog box Workbook connections, you select one of the connections of your workbooks (here there is only one connection) and you click on Properties …
Select the option Refresh data when opening the file
Don’t forget to save and close your file.
If you have multiple files with Power Query and one file get data from another files results of Power Query then you can schedule some code to refresh connections. You can create Console App (C# language), add some library to work with Excel, get target files, open its workbook, refresh connections.
Like here:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b288098d-d4e8-4845-ae3f-38ad235e22aa/how-to-execute-a-quotrefresh-allquot-for-excel-programmatically-in-c?forum=csharpgeneral
Open Excel File, Refresh Query and Save C#
This way multiple files with Power Query will have always updated results of Power Query.
And your one main file with Power Query that get data from results of Power Query from this multiple files will have always updated data.

Change data source of a list table in Excel 2010

Is there a way to change the data source of a list table in Excel? It's easy to change the data source of a pivot table but the only way I have found to change the data source of a list table is to delete the table and start again.
Just to be clear, what I mean by a list table is what you get when you set up a connection to a table or query in Access (for example) and then click on "Existing Connections" under the Data tab.
I would prefer a method using the usual user interface but if there is a method that works only in VBA, that would be fine.
You can do it from the Excel interface without VBA.
Under the Data tab, click on Connections.
From the Workbook Connections dialog, click Properties.
From the Connection Properties dialog, click Definition.
Browse for a connection file and then select a table.
That's it.
If your data source is inside Excel on another sheet and you're using OLE DB Query, you might find changing the data source impossible (which was the case with me).
To change the data source in this instance, you need to click on Resize Table under the Table Design tab in Excel, as can be seen below:
When you click on this, you are able to change the range of your query, as can be seen below:

Resources