This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowThe Fabric community is now in read-only for platform upgrade. Learn more
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
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.
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.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |