cancel
Showing results for 
Search instead for 
Did you mean: 
Liliia_DevX
Sisense Team Member
Sisense Team Member

How to Hide Export to Excel Option On a Pivot Table (Linux)

This article provides an example of a code snippet that could be used to hide a specific option from the Download menu on a widget level.

If you find yourself needing to hide the export to Excel option for some widgets, it might be possible to achieve it with the help of JavaScript. 

Note: The script was developed on L2023.3 Sisense Linux-based version. 

This is an example JavaScript code snippet that could be used for hiding the export to Excel option from the Download menu. In order to apply it, open the pivot in edit mode and click the 3 dots menu:

 

Screenshot 2023-04-12 at 15.49.34.png

 

Paste the following code snippet and Save the changes:

 

 

 

widget.on('beforewidgetindashboardmenu', (se, ev) => {
ev.items.find(i => i.id === 'download').items = ev.items.find(i => i.id === 'download').items.filter(i => !i.command || (i.command && i.command.title !== "dashboard.widget.commands.excel.title"))
});

 

 

After that press "Apply" on the widget. That's it!

Before:

 

Screenshot 2023-04-12 at 16.57.27.png

 

After:

 

Screenshot 2023-04-12 at 16.56.51.png

 

Feel free to use this code snippet as an example and enhance it further to achieve similar goals and share such solutions with us!

Disclaimer: Please note, that this blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their own environment prior to deploying them to ensure that the solutions proffered function as desired in their environment. For the avoidance of doubt, the content of this blog post is provided to you “as-is” and without warranty of any kind, express, implied or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding which is outside the Sisense product development environment and is therefore not covered by not covered by Sisense warranty and support services.

Rate this article:
Comments
Jijish
8 - Cloud Apps
8 - Cloud Apps

Thank you, I was able to hide the Excel/CSV download option using this script. However, if one navigates to the full-screen mode of the widget, then the option to download Excel / CSV is still available. Any pointers on disabling the CSV/Excel download in the full-screen view? I have a requirement to enable the download of CSV / Excel in certain widgets and hence disabling downloads at the dashboard level is not an option I can pursue.

ILLIA
Sisense Team Member
Sisense Team Member

@Jijish Greetings

Please find here script example of how you can disable download option in fullscreen mode as well:

prism.on('beforemenu', (se, ev) => {



if(ev.settings.items.find(i => i.id === 'download')){

ev.settings.items.find(i => i.id === 'download').items = ev.settings.items.find(i => i.id === 'download').items.filter(i => !i.command || (i.command && i.command.title !== "dashboard.widget.commands.csv.title"))



}

if(ev.settings.items.find(i => i.caption === 'we.toolbar.commands.downloadCSV')){

ev.settings.items = ev.settings.items.filter(i => i.caption !== 'we.toolbar.commands.downloadCSV')

}

if(ev.settings.items.find(i => i.commandArgs && i.commandArgs.title === 'we.toolbar.commands.downloadCSV')){

ev.settings.items = ev.settings.items.filter(i => !i.commandArgs || (i.commandArgs && i.commandArgs.title !== 'we.toolbar.commands.downloadCSV'))

}





});

Please inform on the result.

Best regards,

Illia

Jijish
8 - Cloud Apps
8 - Cloud Apps

Thank you @ILLIA . It is working !!

Version history
Last update:
‎04-12-2023 10:03 AM
Updated by: