9

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?

Przemyslaw Remin
  • 6,276
  • 25
  • 113
  • 191
  • 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 Aug 29 '18 at 16:30
  • Microsoft appears to be making some progress in the ability to do this sort of thing. See the [September 2018 Feature Summary](https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-september-2018-feature-summary/#copy). – Alexis Olson Sep 13 '18 at 19:43
  • @VishalShukla we are talking about published report only, so your suggestion is not applicable. – Przemyslaw Remin Sep 14 '18 at 11:12
  • 1
    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 Sep 15 '18 at 16:07
  • Harvest/Scrap the lastest data from soure Power BI and use it as fuel for your Power BI Report. p.s - Make sure the data harevested is the latest. – Vijay Anand Pandian Sep 15 '18 at 16:16
  • 1
    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: https://learn.microsoft.com/en-us/rest/api/power-bi/ https://learn.microsoft.com/en-us/rest/api/power-bi/reports/exportreport – Hellohowdododo Sep 16 '18 at 03:39
  • you could also try via PowerBi rest api https://learn.microsoft.com/en-us/rest/api/power-bi/ – lukaszberwid Sep 17 '18 at 10:35

1 Answers1

6

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.

Mike Honey
  • 14,523
  • 1
  • 24
  • 40
  • I do not know JS. How should I start to take advantage of your hint? – Przemyslaw Remin Oct 22 '20 at 16:03
  • They provide a sample playground where you can generate code and try out methods. But realistically you would need help from a JS dev. https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html – Mike Honey Oct 23 '20 at 01:33
  • They do offer python (flask) samples, but not sure if it suits your deployment scenario: https://github.com/microsoft/PowerBI-Developer-Samples – Mike Honey Oct 23 '20 at 01:34