How to Disable Export to Excel Button in SharePoint Online?
Requirement: Disable Export to Excel in SharePoint Online.
How to Disable Export to Excel in SharePoint Online?
The Export to Excel button located on the toolbar can be helpful for exporting data from your SharePoint lists and Libraries to an Excel spreadsheet. However, sometimes you may not want others to be able to export data from your site using this button. This article will show you how to disable the Export to Excel button in SharePoint Online.
In my case, A business team wanted to remove the ability to export list data into Excel, and here are some available options to disable or hide the “Export to Excel” button in modern SharePoint Online lists.
Option 1: Create a Custom Permission Level without Client Integration Features
The idea is to create a new permission level without “Client integration features” and assign that permission level to users, to disable export to excel. To create a new permission level, follow these steps:
- Click on Settings Gear >> Choose the “Site Permissions” link.
- Click on “Advanced permissions settings.” >> Click on “Permission Levels” from the ribbon.
- Select an existing permission level such as Contribute or Read >> Scroll to the bottom of the page >> Click on the “Copy Permission Level” button.
- Provide a name for your new permission level. E.g., “Read without Client Integration”. Under “Site Permissions”, uncheck “Use Client Integration Features – Use features which launch client applications. Without this permission, users will have to work on documents locally and upload their changes.” and click on “Create” button to create the permission level.
- Assign this custom permission level to users and groups who don’t need the “Export to Excel” option. Make sure the users are not part of any other higher permission groups on the site (Because SharePoint permissions work in a cumulative manner!).
Any user or group with the above permission level won’t get the “Export to Excel” button in SharePoint Online modern lists and libraries. (Export to Excel would be disabled in the classic experience!). Please note this disables other client integration features as well, such as “Open in File Explorer”, “Edit in App”, etc.
Option 2: Inject CSS to the Site to Hide the Export to Excel Button
Instead of dealing with permissions, The second approach disables the export to excel button from everyone, including Site Administrators, with the help of CSS. You have to deploy the SPFx application customizer in modern sites and use the below CSS to remove the export to the Excel button.
button[name="Export to Excel"] {
display: none;
}
Refer to this post to insert CSS in modern SharePoint Online sites: How to Inject Custom CSS to Modern SharePoint Online Sites?
SharePoint Online: Hide Export to Excel in Classic Experience
If you are using Classic experience, You can edit the page, add a script editor web part and then place this CSS to remove export to excel in the SharePoint Online list.
<style type="text/css">
a[id*='ExportToSpreadsheet'] {
display:none;
}
</style>
Option #3: Apply JSON in View Formatting to hide the button
You can also hide the Export to Excel button (or any button using command bar customization!) from the SharePoint Online Toolbar by applying the JSON in the format View: How to Hide a Button in SharePoint Online List or Library Toolbar?
Conclusion
In conclusion, Disabling the Export to Excel button can be useful in scenarios where you want to restrict access to data, or where you want to prevent data loss or leakage. Disabling the Export to Excel button in SharePoint Online is a simple process that can be accomplished using any of the methods explained in this article. However, keep in mind that disabling the Export to Excel button may also make it difficult for users to perform certain tasks, such as data analysis or reporting. Therefore, it’s important to carefully consider the consequences before disabling the Export to Excel button.
Thanks