Export data from a visual

In Power BI you can export the data that was used to create a visual as an Excel or a CSV file, by using the Export data command on the options menu.

The Export data command in the options menu lets you export the data that was used to create a visual into an Excel or a CSV file.

Screenshot that shows a Power B I visual with the options menu open and highlighted the export data command.

Use the Power BI Client visual.exportData API to export data from a report visual into CSV format.

How to export a visual's data

The Power BI Client VisualDescriptor class defines the exportData method as:

exportData(exportDataType?: ExportDataType, rows?: number): Promise<IExportDataResult>

The exportData method uses two parameters:

  • exportDataType (optional), choose which data you like to export Summarized data or Underlying data.

    • ExportDataType.Summarized, select this option if you want to export data for what you currently see in the visual.
    • ExportDataType.Underlying, select this option if you want to export data for what you see in the visual plus additional data from the underlying dataset.

    If not provided the data will be exported Summarized. Learn more about the different types in Export data from a visual.

  • rows, the number of rows to return, if available.

The exportData method returns an IExportDataResult object, use the IExportDataResult.data property to get the exported data as a string in a CSV format.

interface IExportDataResult {
    data: string;
}

Example

To export the first 100 rows of summarized data:

let result = await visual.exportData(models.ExportDataType.Summarized, 100);

console.log(result.data);

Considerations and limitations

  • The maximum number of rows you can export is 30,000.
  • Exports using Underlying don't work if the data source uses Analysis Services live connection on versions older than 2016, when the tables in the model do not have a unique key.
  • Exports using Underlying don't work if Show items with no data is enabled for the visualization.
  • If filters are applied to the visualization, the exported data will also be filtered.
  • If using DirectQuery, the maximum amount of data that can be exported is 16 MB. Exports may result in less than the maximum number of rows, especially if when using multiple columns, data that is difficult to compress, or factors are present that increase file size and decrease number of rows exported.
  • Power BI only supports export on visuals that use basic aggregates. Export is not available on visuals using model or report measures.
  • Custom and R visuals, aren't supported.
  • Power BI admins can disable the export data feature.
  • Concurrent export data requests from the same session aren't supported. Multiple requests should be run synchronously.

Next steps