8
votes

How to import data in any programming way from published specific Power BI visual to another PBI report or SQL Server table or just scrap it to local drive? I would like to achieve the same effect as by clicking on three dots ... in the right upper corner of published PBI visual > export data > Save as to local drive. enter image description here

This gets me the whole table of data I need without looking at the complexity how the visual was produced by someone else (i.e. joining many tables on unknown keys). Whatever the pros and cons, I want to get data from the external report of PBI visual, not from Power BI datasets nor from any other primery source of external report.

Ideally, I would like to plug to the visual of external report as a source in my Power BI report. If that is not possible, would there be any way using R to open the PBI external report, and export data from specific visual to R data.frame? If not, maybe it could be done in Python or any other program designed for data scraping?

1
I'm guessing there isn't a clean way to do this as the values in a visual are not stored in the pbix file. You'd have to recreate the filter context or else scrape the data programmatically. - Alexis Olson
Microsoft appears to be making some progress in the ability to do this sort of thing. See the September 2018 Feature Summary. - Alexis Olson
@VishalShukla we are talking about published report only, so your suggestion is not applicable. - Przemyslaw Remin
Goal: Scrap data from Published BI report. My suggestion is, you could go for selenium and python combo to simulate the browser actions in a silent mode and harvest the data. (export data in the local temp folder and push it your SQL server to create another report) There may be better library than selenium that can also simulate browser actions in a silent manner. Currently, I am unaware of that. I am sure the above solution is achievable. - Vijay Anand Pandian
Well, it can be achievable with selenium + headless chrome + beautifulsoup, but maybe it would be easier to use some standard API? Maybe this will help: docs.microsoft.com/en-us/rest/api/power-bi docs.microsoft.com/en-us/rest/api/power-bi/reports/exportreport - Hellohowdododo

1 Answers

5
votes

I would try the exportData method from the JavaScript library for embedding Power BI:

https://github.com/microsoft/PowerBI-JavaScript/wiki/Export-Data

Your screenshot implies that you are accessing the report through the Power BI web service app.powerbi.com. Once you have opened the report using that portal, the menu option Share / Embed report / Website or portal will give you the secure token you need to get started.