Skip to content

Export Data

Amit Shuster edited this page Jan 24, 2021 · 7 revisions
ℹ️ This wiki has been deprecated
All our Client APIs documentation and references can be found in the new Power BI embedded analytics Client APIs documentation set.
For the content of this article see Export data from a visual.

By using export data API you can export data from visualizations in CSV format.

Export Data in Power BI

To read about export data in powerbi.com please refer to Export Data Documentation

Export Data API

use exportData method on a Visual Descriptor object in order to get visual data.

exportData method parameters:

  1. exportDataType - Optional parameter which can be Summarized or Underlying.

    • Underlying data: select this option if your visualization does have an aggregate and you'd like to see all the underlying details. Basically, selecting Underlying data removes the aggregate.

    • Summarized data: select this option if you don't have an aggregate or if you do have an aggregate but don't want to see the complete breakdown. For example, if you have a bar chart showing 4 bars, you will get 4 rows of data.

  2. rows - number of rows to return if available.

Code Sample

Example: Export first 100 rows of summarized data.

    // Exports visual data
    visual.exportData(models.ExportDataType.Summarized, 100)
      .then(function (data) {
        Log.log(data);
      })
      .catch(function (errors) {
        Log.log(errors);
      });

Limitations and considerations

  • The maximum number of rows that can be exported using API to .csv is 30,000.

  • Export using Underlying data will not work if the data source is an Analysis Services live connection and the version is older than 2016 and the tables in the model do not have a unique key.

  • Export using Underlying data will not work if the Show items with no data option is enabled for the visualization being exported.

  • If you have applied filters to the visualization, the exported data will export as filtered.

  • When using DirectQuery, the maximum amount of data that can be exported is 16 MB. This may result in exporting less than the maximum number of rows, especially if there are many columns, data that is difficult to compress, and other factors that increase file size and decrease number of rows exported.

  • Power BI only supports export in visuals that use basic aggregates. Export is not available for visuals using model or report measures.

  • Custom visuals, and R visuals, are not currently supported.

  • Power BI admins have the ability to disable the export of data.

  • Concurrent export data requests from the same session are not supported. Multiple requests should be run synchronously.