Show Table of Contents
Tableau supports a set of functions that you can use to pass expressions to external services for integration with R, MATLAB, and Python.
Available External Services
Configure an External Service Connection
Share a Workbook That Requires an External Service Connection
Publish a Workbook That Requires an External Service Connection
Also see Troubleshooting External Service Connections.
Tableau supports integration with the following services:
R is an open source software programming language and a software environment for statistical computing and graphics.
MATLAB® is a high-level language that enables you to perform computationally intensive tasks faster than with traditional programming languages such as C, C++, and Fortran. You can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology. For information on how to configure your MATLAB server to work with Tableau please contact MATLAB support.
To read more about the possibilities of MATLAB in Tableau, see Put your MATLAB models and algorithms to work in Tableau.
Python is a widely used high-level programming language for general-purpose programming. By sending Python commands to an external service, you can do things like predicting customer churn or running sentiment analysis.
Tableau Python Server (TabPy) is part of Tableau's expanding range of extensibility options. To install TabPy, visit this GitHub page. To read more about the possibilities of Python in Tableau, see Building advanced-analytics applications with TabPy.
In Tableau Desktop, a set of four SCRIPT functions are available for passing expressions to external services and obtaining a result. The functions are:
See SCRIPT_BOOL for details and examples. Because these SCRIPT_ functions are table calculations functions, addressing and partitioning concepts apply. (For an explanation of these concepts, see Table Calculations: Addressing and Partitioning.) Tableau makes one call to an external service per partition.
Because connecting to an external service involves some overhead, try to pass values as vectors rather than as individual values whenever possible. For example if you set addressing to Cell (for example, by clicking the field in the view and choosing Compute Along > Cell), Tableau will make a separate call per row to the external service; depending on the size of the data, this can result in a very large number of individual calls. If you instead use a column that identifies each row that you would use in the level of detail, you could compute along that column so that Tableau could pass those values in a single call.
To use the SCRIPT functions, you must establish a connection to an external server.
For R, you need access to a server that allows applications to access R functionality. See Rserve for details. For information on installing, running, and configuring Rserve, as well as on optimizing R scripts and R security, see the Tableau Community post R Implementation Notes. And for more information about using R with Tableau, see the blog post Tableau 8.1 and R.
Note: For R integration, Tableau has been tested with R versions 3.1 and 3.2, and with Rserver version 0.6-8.
In Tableau Desktop, click the Help menu, and then select Settings and Performance > Manage External Service connection to open the External Service Connection dialog box:
Enter or select a server name using a domain or an IP address. The drop-down list includes localhost and the server you most recently connected to.
Specify a port.
Note: Port 6311 is the default port for Rserve servers.
If the server requires credentials, specify a Username and Password.
Click Test Connection.
If no connection can be established, an error message is displayed. Click Show Details in the message to see any diagnostic information returned by the server.
You may need to send a workbook that contains external service functionality to other users, who may be using different copies of Tableau Desktop on other computers. Or, users may download a workbook from Tableau Server that contains external service functionality. Before users will be able to use the external service functionality in workbooks they have received or downloaded to Tableau Desktop, they must configure external service connections on their computers.
Before you publish a workbook that relies on an external service connection to Tableau Server, you should verify that the server is configured to be able to run scripts, and also configure Tableau Server to have its own external service connection.
If you publish a workbook that relies on an external service connection, you must verify that the server is configured to allow scripts. The following two settings are relevant:
This setting allows affects scripts of all kinds (initial sql, custom sql, script calcs) in published workbooks. The default value is false. Setting it to true allows scripts that include string parameters (that is, scripts that reference a Tableau parameter) to run. Scripts that reference a Tableau parameter can constitute a vulnerability because of the potential for injection of code.
This parameter determines whether external service calls from a workbook on Tableau Server can run. The default value is true, which seems like it would mean that scripts are disabled. But in fact true means scripts can run. To prevent scripts from running, set this parameter to false. This parameter does not affect the ability to upload workbooks with scripts, only the ability to execute script commands once a workbook is uploaded.
Use the tabadmin command line tool to configure these settings. For details, see tabadmin in the Tableau Server help.
You do this by configuring settings with
tabadmin set. The settings are equivalent to the values you set in the External Service Connection dialog box. They are:
An additional setting,
vizqlserver.esxtsvc.connect_timeout_ms, is available for extending the timeout value, in milliseconds, for connections to Microsoft’s RServer. Raise the value of this setting if Tableau is timing out before the server can respond.
For more information on these settings, see tabadmin set options in the Tableau Server help.
Note: If you configured Tableau Server for an external service connection prior to Tableau 10.0, these settings had different names. The configuration
vizqlserver.extsvc was introduced in Tableau Server 10.1 as a replacement for
vizqlserver.rserve. However, there is reverse compatibility in Tableau Server starting with version 10.1. In these more recent versions of Tableau Server,
vizqlserver.extsvc settings will be checked for first, but if there are no
vizqlserver.extsvc settings then Tableau Server will check for
vizqlserver.extsvc.password should be omitted if Tableau Desktop connects to Rserve without a username and password.
For information on how to use the above
tabadmin set options to configure Tableau Server, see Change Tableau Server's Configuration from the Command Line.
Tableau cannot verify that workbooks that use an external service will render properly on Tableau Server. There might be scenarios where a required statistical library is available on a user’s machine but not on the external service instance that Tableau Server is using.
For views that cannot be rendered in Tableau Server because of a script error, you see a warning error when you publish the workbook:
This worksheet contains external service scripts, which cannot be viewed on the target platform until the administrator configures an external service connection.
You cannot publish a workbook that contains external service scripting to Tableau Online.
Because Tableau Server provides an authentication mechanism, it can be more secure to expose external service functionality to users through Tableau Server than in Tableau Desktop.