Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (17.6k points)

I have to export all data from PowerBI visuals.

I managed to use a library powerbi.js ( and manage to implement the following solution:"ReportSection").getVisuals()

   .then(function(visuals) {

        return visuals.find(function (visual) { return === "829c5bdfe33aba301b32" });

    }).then(function(emailVisual) {

        return emailVisual.exportData(models.ExportDataType.Summarized)

    }).then(function(result) { 



However, because the visual (which is a table) uses a lazy load to load all the entries, when I export the data - it only exports records, that are currently loaded into the visual.

To load more data, I need to scroll down the table and call the above code again.

Is there a solution to export all data programmatically at once? 

1 Answer

0 votes
by (47.2k points)
  • When embedding Power BI reports with PowerBI Javascript API, There's an event called "dataSelected". It can capture the selected data. eg, when clicking on a histogram, the selected data gets captured.

  • Whenever we click on a table visual, there no such event triggered. A working solution is using a column chart that shows the same data in your table visual

  • This  PowerBI Javascript API can be applied to embed reports from both Power BI Service and Power BI Embedded.


  <script src=""></script>

<script src=""></script>


<script type="text/javascript">

window.onload = function () {


var embedConfiguration = {

    type: 'report',

    accessToken: 'yourToken',

    id: 'yourReportID',

    embedUrl: ''     


var $reportContainer = $('#reportContainer');


var report = powerbi.embed($reportContainer.get(0), embedConfiguration);

 var reportPages; 


report.on('dataSelected', function(event)


var data = event.detail;


         console.log(JSON.stringify(data, null, ' '));







<div  id="reportContainer"></div>


Browse Categories