Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Download Table view Data Using Button

Hi,

I have a requirement to disable the export data option on live reports and provide a button that will do the same. The report table data should download when this button is clicked.

any suggestions? It's pretty urgent

Thank you

2 REPLIES 2
Krina234pestro
New Member

Hello,

 

To achieve this, you can follow these steps:

Disable the Export Data Option:
If you’re using Power BI, you can disable the export data option for specific reports by going to the report settings and setting the “Export Data” option to "None".
For ASP.NET Core Report Viewer, you can hide the export options using the exportOptions property.
Create a Custom Download Button:
You can add a custom button to your report or web page that triggers the download of the table data. Here’s a basic example using Javascript: 

<button id="downloadButton">Download Data</button>
<table id="dataTable">
<!-- Your table data here -->
</table>

<script>
document.getElementById('downloadButton').addEventListener('click', function() {
var table = document.getElementById('dataTable');
var rows = table.rows;
var csvContent = '';

for (var i = 0; i < rows.length; i++) {
var cells = rows[i].cells;
var rowContent = [];
for (var j = 0; j < cells.length; j++) {
rowContent.push(cells[j].innerText);
}
csvContent += rowContent.join(',') + '\n';
}

var blob = new Blob([csvContent], { type: 'text/csv' });
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('download', 'table_data.csv');
a.click();
});
</script>

This script will create a CSV file from the table data and download it when the button costcoess is clicked.

monica345
New Member

Hello,

Remove Export to Excel/CSV: In the Power BI Desktop, go to View -> Data View, and right-click on the table you want to disable exports for. Uncheck Export Data: In the Properties pane, uncheck the Export Data option. Create a Custom Action: In the Power BI Desktop, go to View -> Data View, right-click on the table, and select New Custom Action. Define Action: In the New Custom Action dialog, give the action a Patient Gateway name and define the logic to download the data (e.g., using a REST API call or DAX query). Add Button: Add a button to your report and assign the custom action to it. Develop a Custom Visual: Create a custom visual that replaces the default table visual and disables the built-in export functionality. Implement Download Button: Add a button to the custom visual that triggers the download functionality when clicked.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.