excelcsvpowerbipowerbi-embeddedpowerbi-api

Get the complete data of a visual in powerbi from an embedded report and export to CSV/excel


I have a powerbi report embedded in a react app. In the page I have a table visual from which I want to export the complete data in form of CSV/Excel.

This is the way I am currently using:

const pages = await report.getPages();
let page = pages.filter(function (page) {
  return page.isActive;
})[0];
const visuals = await page.getVisuals();
for (let index = 0; index < visuals.length; index++) {
  if (visuals[index].title === "Extra Col") {
    let result = await visuals[index].exportData(
      models.ExportDataType.Summarized
    );
    console.log("result data", result);

After getting the result I am converting the data like this:

const csvArray = result.data.split("\r\n").map((row) => row.split(","));

and then passing the csvArray data to react-csv to download as csv.

In this way I am only getting the data of first 1500 to 1600 rows. I want to know is there any way to get the complete data or directly export the data in form of CSV/Excel


Solution

  • Using models.ExportDataType.Summarized will export data what you see currently in the visual.

    Use models.ExportDataType.Underlying and it will export data what you see in the visual plus additional data from the underlying dataset.

    Refer Export Data from a visual for more information.

    The maximum number of rows you can export is 30,000. Check Considerations and limitation.