Help Centre › Building Processes
This article describes the RPA Database functionality to export query results to a CSV file.
For a full list of available functions, please read DATABASE functions.
Description
The Export query to CSV function executes a SELECT query and writes the results to a CSV file. The first row of the output file contains the column headers.
Setting it up
To use the Export query to CSV function, follow these instructions:
{{popups:rpas/add:action=db-export-csv}}
Once on a process map:
- Navigate to the process where you would like to add the Export query to CSV function
- Click on the green button's drop-down (right side of the green button labelled "Process")
- On the menu that appears, click on the "+ Activity" item
- From here you can select the Export query to CSV option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Name | Yes | Text | - | The alias of a previously opened connection (from db-connect) |
| Query | Yes | Text | - | The SQL SELECT statement to execute |
| Path | Yes | Text | - | The file path where the CSV will be written |
| Params | No | Array | - | An array of values for parameterised queries |
| Delimiter | No | Text | , | The column delimiter character |
Output variables
This action does not produce output variables.
Errors
| Error | Description |
|---|---|
| Connection not found | No open connection exists with the specified name |
| Query error | The SQL query contains a syntax error or references invalid objects |
| File write error | Unable to write to the specified file path |
Tips
- Use SELECT with specific column names rather than SELECT * to control the output format
- Ensure the target directory exists before exporting
- Use parameterised queries to safely include dynamic filter values