With the Python script below and the Window Scheduler, you can automate exporting and emailing dashboards in either PDF or PNG format.
Update:
The ability to attach a PDF to an email report is now available on Sisense V6.2
Note
The script will export and email the dashboards that are owned by a given Sisense user (see parameter dashboardOwnerSisenseEmail below). Therefore, this script needs to be created for each dashboard owner
Prerequisites
- Install python 3.4.3 (download here). If you already have an earlier python version installed – please remove it prior to installing python 3.4.3
- Install python c++ compiler (download here)
- Download the following python dependencies:
- jwt (pip module PyJWT)
- parse (pip module parse)
- requests (pip module requests)
All python dependencies can be downloaded with pip. Open command prompt as an administrator and type the following for downloading PyJWT for instance:
py –m pip install PyJWT
Script
The exportAndEmailDashboards.py script is attached.
Configuration
Note the configuration section in the script to set up all necessary parameters:
- dashboardNames = provide the EXACT dashboard names, separated by ';' If you wish to export only one dashboard, you do not need to add the ‘;’ at the end
- filepath = the location to export the dashboard, in the following format: C:\\folder1\\folder2\\
- ext = choose the dashboard format type - can be only “.PDF” or “.PNG”
- SMTPServer = the email SMTP server name, for example "smtp.gmail.com"
- SMTPPort = the email SMTP server port. For google SMPT server it is 587
- SMTPServerAdminEmail = the SMTP server Admin's email address, used to send emails
- SMTPServeradminPassword = the SMTP server Admin's email password
- isSMTPAuthNeeded - If you provided SMTPServerAdminEmail & SMTPServerAdminPassword, set this attribute to True. Otherwise set it to False
- toaddr, ccaddr = comma separated list of emails addresses that should receive the dashboard. You can keep the ccaddr empty
- server = Sisense Server the protocol (http://), hostname (or IP address), & port number of the Sisense web server. For example, http://mySisenseServer.com:8081
- dashboardOwnerSisenseEmail = the login email of dashboard(s) owner in Sisense, used for API calls
- dashboardOwnerSisensePassword= the login password for the dashboard(s) owner in Sisense, used for API calls
- restAPIToken = the key for Sisense's REST API, which can be found in your Sisense Server's REST API Management web page.
Windows Scheduler
See here how to schedule a task in Windows. You can read this stack overflow post about scheduling the task every hour.
The command that you need to set in the Scheduler is the following:
py \...\exportAndEmailDashboards.py, for example
py c:\Temp4\exportAndEmailDashboards.py
Download:
Export And Email Dashboards.py