Export Power BI Visual Data to Excel
Export Power BI visual data to Excel through the PBRS REST API, with summary or underlying data, worksheet formatting, and workbook templates.
Export data from supported Power BI visuals into Excel workbooks using a PBRS schedule. Choose summary or underlying data, organize visuals into worksheets, apply formatting, and configure workbook-template placement.
The export runs through the schedule's configured destination. The schedule-creation response returns an identifier, not an Excel file.
Before you begin
You need:
- A running PBRS REST API service.
- A valid access token.
- A configured Power BI account with access to the report.
- The report URL returned by discovery.
- The page index and exact title of each visual to export.
- An existing PBRS folder.
- An email or disk destination for the workbook.
Complete Discover Folders, Reports, and Reporting Resources and Create and Update Single Schedules first.
This guide covers visual-data export from Power BI reports. Paginated-report Excel export uses a different report and output workflow.
1. Discover the visual
Use:
GET /api/PowerBiAccount/GetVisualsForReport
The request requires a JSON body containing AccountId and ReportUrl.
An example response is:
{
"0": [
"Sales by region",
"Monthly revenue"
]
}Retain the numeric page index and exact visual title.
Visual page indexes are zero-based. Page 0 is the first report page.
Do not reuse the one-based page numbers used by RenderingSettings.PagesToRender.
Rediscover visuals after changes to report pages, page order, or visual titles.
2. Select data-only Excel output
Set the destination's OutputFormat to exactly:
MS Excel - Data Only (*.xlsx)
Add a nonempty PowerBIDataOnlyExportSettings array to that destination.
The settings belong inside an email or disk destination, not at the top level of the schedule:
{
"EmailDestinations": [
{
"DestinationName": "Excel delivery",
"DestinationType": "Email",
"Enabled": true,
"OutputFormat": "MS Excel - Data Only (*.xlsx)",
"To": [
"[email protected]"
],
"Cc": [],
"Bcc": [],
"Subject": "Power BI data export",
"Body": "Attached is the exported visual data.",
"BodyFormat": "TEXT",
"EmbedReport": false,
"PowerBIDataOnlyExportSettings": [
{
"PageNumber": 0,
"VisualTitle": "Sales by region",
"ExportType": 0,
"WorksheetName": "Regional Sales",
"OrderNumber": 0,
"UseExcelTemplate": false,
"ColumnsToSummarize": [],
"RowsToSummarize": [],
"ExcelColumnFormats": []
}
]
}
]
}This is a destination section, not a complete schedule request.
Keep EmbedReport set to false when configuring the workbook as an email attachment.
3. Choose summary or underlying data
ExportType | Selection |
|---|---|
0 | Summary data |
1 | Underlying data |
Summary data reflects the visual's summarized values. Underlying export requests the supporting data available through the report's export capability.
Underlying data availability depends on the report, visual, model, permissions, and applicable Power BI export restrictions. Setting ExportType to 1 does not override those restrictions.
Confirm that the selected visual supports the intended export. Do not assume that every visual exposes underlying data or that an export contains every row in the underlying model.
4. Create a schedule
The following definition creates a disabled daily schedule that exports one visual to an email destination.
Replace the account ID, report URL, workspace name, folder, start date, recipient, and visual information with values from your installation.
Save the complete JSON as pbrs-excel-schedule.json:
{
"ScheduleName": "API Excel visual export",
"FolderPath": "/API Reports",
"Description": "Export regional sales data to Excel",
"Keywords": "api,excel,setup-test",
"DataDriven": false,
"PowerBiAccountId": "7f320302-7ccb-4aba-a052-56197424ab36",
"ObjectType": "REPORT",
"ReportUrl": "https://app.powerbi.com/reportEmbed?reportId=64e25062-4786-43be-bfea-56ec8b9aaeca",
"PowerBiReportName": "Sales overview",
"WorkspaceName": "Sales",
"ApplyBookmark": false,
"ApplyBookmarkState": false,
"BasicFilters": [],
"AdvancedFilters": [],
"RenderingSettings": {
"MinLoadingTime": 10,
"MaxLoadingTime": 60,
"PageWidth": 1300,
"PageHeight": 800,
"PagesToRender": "",
"RenderingMethod": 1
},
"Schedule": {
"Frequency": "Daily",
"StartDate": "2026-10-01",
"ExecutionTime": "09:00",
"HasEndDate": false,
"Repeat": false,
"Enabled": false,
"DailyRepeatInterval": 1
},
"EmailDestinations": [
{
"DestinationName": "Excel test delivery",
"DestinationType": "Email",
"Enabled": true,
"OutputFormat": "MS Excel - Data Only (*.xlsx)",
"To": [
"[email protected]"
],
"Cc": [],
"Bcc": [],
"Subject": "Regional sales workbook",
"Body": "Attached is the regional sales data export.",
"BodyFormat": "TEXT",
"EmbedReport": false,
"PowerBIDataOnlyExportSettings": [
{
"PageNumber": 0,
"VisualTitle": "Sales by region",
"ExportType": 0,
"ExcelStyle": "",
"WorksheetName": "Regional Sales",
"OrderNumber": 0,
"UseExcelTemplate": false,
"ColumnsToSummarize": [],
"RowsToSummarize": [],
"ExcelColumnFormats": []
}
]
}
],
"DiskDestinations": []
}Schedule.Enabled is false so recurring execution remains disabled during setup. The destination is enabled for a controlled execution test.
The visual is selected by PageNumber and VisualTitle. PagesToRender does not replace those fields.
Submit the definition
Use the $PbrsAccessToken obtained in Authentication and Token Management:
$PbrsBaseUrl = "http://localhost:9000"
if ([string]::IsNullOrWhiteSpace($PbrsAccessToken)) {
throw "Obtain a PBRS access token before continuing."
}
$PbrsHeaders = @{
Accept = "application/json"
Authorization = "bearer $PbrsAccessToken"
}
$PbrsDefinition = Get-Content `
-LiteralPath "./pbrs-excel-schedule.json" `
-Raw |
ConvertFrom-Json -ErrorAction Stop
$PbrsRequestJson = $PbrsDefinition |
ConvertTo-Json -Depth 30
$PbrsCreated = Invoke-RestMethod `
-Method Post `
-Uri "$($PbrsBaseUrl.TrimEnd('/'))/api/SingleSchedule/CreateForPowerBI" `
-Headers $PbrsHeaders `
-ContentType "application/json" `
-Body $PbrsRequestJson `
-TimeoutSec 60 `
-ErrorAction Stop
if ($null -eq $PbrsCreated.uniqueid) {
throw "No schedule identifier was returned. Reconcile the request before submitting again."
}
$PbrsScheduleId = [long]$PbrsCreated.uniqueid
Write-Host "Created schedule: $PbrsScheduleId"Use your actual API address. localhost applies only when running the command on the PBRS server.
A successful creation returns:
{
"uniqueid": 101
}Retain the returned identifier and submitted definition.
If creation times out, check whether the schedule was saved before repeating the request.
5. Export multiple visuals
Add one entry per visual to the destination's PowerBIDataOnlyExportSettings array:
[
{
"PageNumber": 0,
"VisualTitle": "Sales by region",
"ExportType": 0,
"WorksheetName": "Regional Sales",
"OrderNumber": 0,
"UseExcelTemplate": false
},
{
"PageNumber": 0,
"VisualTitle": "Monthly revenue",
"ExportType": 0,
"WorksheetName": "Monthly Revenue",
"OrderNumber": 1,
"UseExcelTemplate": false
}
]Use WorksheetName to assign worksheet names and OrderNumber to set their order.
When WorksheetName is empty, PBRS uses the visual title. Assign explicit, valid, distinct worksheet names when exporting several visuals.
Keep visual titles exact. Changing the worksheet name does not change which visual is selected.
6. Apply worksheet styling
ExcelStyle contains JSON encoded as a string. Do not assign a nested JSON object directly to that property.
An empty or null ExcelStyle uses the default styling.
The following PowerShell example constructs styling for headers, alternating rows, and totals, then assigns the serialized string to the first visual configuration.
Run it before serializing and submitting the complete schedule:
function New-PbrsExcelStyleSection {
param(
[int]$Weight,
[hashtable]$FontColor,
[hashtable]$BackgroundColor
)
return @{
fontWeight = $Weight
fontColor = $FontColor
backgroundColor = $BackgroundColor
borderColor = $BackgroundColor
}
}
$PbrsWhite = @{ Red = 255; Green = 255; Blue = 255 }
$PbrsBlack = @{ Red = 0; Green = 0; Blue = 0 }
$PbrsBlue = @{ Red = 91; Green = 159; Blue = 210 }
$PbrsPaleBlue = @{ Red = 221; Green = 235; Blue = 247 }
$PbrsExcelStyle = @{
headerStyle = (
New-PbrsExcelStyleSection 700 $PbrsWhite $PbrsBlue
)
evenRowStyle = (
New-PbrsExcelStyleSection 400 $PbrsBlack $PbrsPaleBlue
)
oddRowStyle = (
New-PbrsExcelStyleSection 400 $PbrsBlack $PbrsWhite
)
columnTotalsStyle = (
New-PbrsExcelStyleSection 700 $PbrsWhite $PbrsBlue
)
rowTotalsStyle = (
New-PbrsExcelStyleSection 700 $PbrsWhite $PbrsBlue
)
tallyUpRows = $false
tallyUpColumns = $false
}
$PbrsDefinition.EmailDestinations[0].
PowerBIDataOnlyExportSettings[0].ExcelStyle = (
$PbrsExcelStyle | ConvertTo-Json -Depth 10 -Compress
)After making changes, serialize the complete definition with ConvertTo-Json -Depth 30.
There are two serialization levels:
- Serialize the style object into the
ExcelStylestring. - Serialize the complete schedule into the HTTP request body.
Do not double-encode the complete schedule as another JSON string.
7. Configure totals
Each visual configuration supports:
| Field | Values |
|---|---|
ColumnsToSummarize | Excel column letters, such as ["B", "D"]. |
RowsToSummarize | Worksheet row numbers, such as [2, 3]. |
The style configuration also exposes tallyUpRows and tallyUpColumns for the corresponding total calculations.
Choose the row or column direction you intend to total, configure the applicable selectors, and verify the generated workbook.
These selectors refer to the exported worksheet layout. They are not Power BI model field names or report page indexes.
Check that selected cells contain appropriate numeric values. Layout changes can move the data into different rows or columns.
8. Use an Excel template
Template settings belong to each visual export entry.
Example settings:
{
"PageNumber": 0,
"VisualTitle": "Sales by region",
"ExportType": 0,
"WorksheetName": "Regional Sales",
"OrderNumber": 0,
"UseExcelTemplate": true,
"TemplateExcelFile": "C:\\PBRS\\Templates\\SalesTemplate.xlsx",
"UseNextAvailableColumn": false,
"UseNextAvailableRow": false,
"SpecificColumn": "C",
"SpecificRow": "5",
"ExcelColumnFormats": []
}The template must be accessible to the PBRS installation that executes the schedule. A path on the API caller's computer is not automatically accessible to PBRS.
In a distributed environment, ensure that the template is available to each server that may execute the schedule.
Placement options
| Field | Meaning |
|---|---|
UseExcelTemplate | Enables template use. |
TemplateExcelFile | Path to the template workbook. |
UseNextAvailableColumn | Selects the next available template column. |
UseNextAvailableRow | Selects the next available template row. |
SpecificColumn | Explicit starting column when automatic column selection is disabled. |
SpecificRow | Explicit starting row when automatic row selection is disabled. |
SpecificRow is a string in the API contract, so the example uses "5".
Check placement against existing formulas, headings, tables, and other content. Do not assume that automatic placement provides a persistent append operation across repeated schedule executions.
Test multiple visual placements for overlap and verify how the selected worksheets are populated.
9. Configure column datatypes and formats
Use the ExcelColumnFormats array within a visual export entry.
| Field | Purpose |
|---|---|
ColumnId | Column identifier for the applicable export configuration. |
ColumnName | Column name. |
DataType | Datatype selector. |
DataFormat | Format string for the selected datatype. |
VisualId | Visual identifier associated with the formatting entry. |
Datatype values are:
| Value | Type |
|---|---|
0 | String |
1 | Numeric |
2 | Date/time |
4 | Boolean |
The boolean value is 4, not 3.
Use identifiers and mappings appropriate to the selected visual. Do not substitute worksheet column letters for ColumnId merely because ColumnsToSummarize uses letters.
Validate the resulting cell types as well as their appearance. A number formatted to look numeric can still be stored as text.
10. Deliver to a disk destination
The same visual settings can be attached to a disk destination:
{
"DestinationName": "Excel archive",
"DestinationType": "Disk",
"Enabled": true,
"OutputFormat": "MS Excel - Data Only (*.xlsx)",
"OutputPath": "C:\\PBRSExports\\Sales",
"PowerBIDataOnlyExportSettings": [
{
"PageNumber": 0,
"VisualTitle": "Sales by region",
"ExportType": 0,
"WorksheetName": "Regional Sales",
"OrderNumber": 0,
"UseExcelTemplate": false
}
]
}Place this object in DiskDestinations within the complete schedule.
For a disk-only schedule, retain EmailDestinations as an empty array and supply a nonempty DiskDestinations array.
Ensure that the executing PBRS environment can write to the output location. Verify file naming and replacement behavior before scheduling repeated exports.
The disk output path and template input path have different purposes. Do not treat the template path as the delivery destination.
11. Update an existing export
Use POST /api/SingleSchedule/UpdateForPowerBI with the existing schedule's uniqueid and its complete intended definition.
Preserve:
- Both destination arrays.
- Existing
DestinationIdvalues. - Visual selections and worksheet order.
- Styling and total settings.
- Template file and placement settings.
- Column-format mappings.
- Filters, bookmarks, recurrence, and other report configuration.
Existing destinations omitted from the submitted arrays are removed.
Read responses may omit some template-placement settings. Do not use a GET response as the sole source for reconstructing an existing Excel export configuration.
Retain the original submitted definition and reconcile it with the current schedule before updating.
A successful full-schedule update returns an empty HTTP 200 response. Retrieve the schedule and verify the configuration afterward.
12. Execute and verify the workbook
Follow Quick Start: Execute and Monitor a Schedule to execute the schedule and monitor its result.
Then inspect the workbook:
- Confirm that the intended visuals were exported.
- Check summary versus underlying data.
- Verify filters and recipient-specific content.
- Confirm worksheet names and order.
- Inspect row counts and representative values.
- Check totals and cell datatypes.
- Verify template placement and existing formulas.
- Confirm delivery to the intended destination.
Only enable recurring execution after the controlled test succeeds.
A successful API request or completed execution is not sufficient evidence that the workbook contains the intended data.
Troubleshooting
| Symptom | What to check |
|---|---|
| Wrong Excel output | Use the exact MS Excel - Data Only (*.xlsx) label. |
| No visual data exported | Confirm that the destination has a nonempty PowerBIDataOnlyExportSettings array. |
| Wrong visual or page | Verify the exact visual title and zero-based page index. |
| Underlying export fails or differs from expectations | Check visual support, model behavior, permissions, and export restrictions. |
| Styling is ignored or rejected | Confirm that ExcelStyle is a JSON-encoded string. |
| Totals are incorrect | Check direction flags, selected rows or columns, and exported cell values. |
| Template cannot be loaded | Check the path and access from the executing PBRS server. |
| Template content is displaced | Check worksheet selection, placement settings, and overlapping exports. |
| Formatting disappears after an update | Restore settings omitted from read-back and preserve the complete intended configuration. |
| Workbook is generated but not delivered | Check destination settings, permissions, and delivery evidence. |
Do not infer a CSV export contract or unrestricted row limits from the availability of Excel visual-data export.
Next steps
Use Manage Destinations and Output Settings for delivery configuration.
Continue with Create and Manage Report Packages when you need multiple reports or recipient-specific processing.
Updated 1 day ago

