---
schema_version: "1"
id: c01c0709bc95ce46284027b8e096fa05f4dcc446071e5f4cea7bb1b436fc176c
title: Use R and Python scripts in your flow
collection: tableau
version: next
locale: en-gb
portal_url: https://docs.salesforce.com/tableau/next/en-gb/prep/prep_scripts.md
canonical_url: https://help.tableau.com/v0.0/prep/en-gb/prep_scripts.htm
source_site: help.tableau.com
content_type: documentation
content_hash: d61954b09009019140b87f795a37498a8f008a4100135f580cb44f6ac450ffde
description: Overview about using R and Python scripts in a Tableau Prep flow for advanced operations.
---
[Skip to main content](#main-content)

# Use R and Python scripts in your flow

Starting in version 2019.3.1, you can use R and Python scripts to perform more complex cleaning operations or incorporate predictive modelling data into your flow. Data is passed from the flow as input through the R or Python script step, then returned as output data that you can continue cleaning using the features and functions of Tableau Prep Builder.

**Note**: Connecting to scripts as an input step for your flow is not yet supported. Also, script steps are not yet supported for flows authored or published to Tableau Cloud.

![The Tableau Prep add a script step.](/tableau/next/en-gb/prep/en-gb/Img/prep_script_step2.png)

Configure your Rserve server or Tableau Python (TabPy) server and add a script step to your flow. Tableau Prep passes the data to Rserve for R or Tableau Python server (TabPy) for Python and returns the resulting data back to the flow in the form of a table. You can continue to apply cleaning operations to the results and generate your output for analysis.

When you create your script, you will need to include a function that specifies a data frame as an argument of the function. If you want to return different fields than what you input, you'll need to include a getOutputSchema function in your script that defines the output and data types. Otherwise, the output will use the fields from the input data.

If you author or edit flows in Tableau Server (version 2020.4.1 and later) that include script steps, Tableau Server must also have a connection to an Rserve or TabPy server to run script steps. For information about how to configure R or Python to use in your flows and how to create your scripts, see [Use R (Rserve) scripts in your flow](https://help.tableau.com/v0.0/prep/en-gb/prep_scripts._R.htm) or [Use Python scripts in your flow](https://help.tableau.com/v0.0/prep/en-gb/prep_scripts_TabPy.htm).

Need help debugging a flow? Try turning on Enable Query Logging from the Help\>Settings and Performance menu. For more information, see [Enable Query Logging](https://help.tableau.com/current/prep/en-gb/prep_troubleshoot.htm#enable-query-logging).

## Other articles in this section