Help Centre › Building Processes
This article describes the RPA Database functionality to export query results to an Excel file.
For a full list of available functions, please read DATABASE functions.
Description
The Export query to Excel function executes a SELECT query and writes the results to an Excel (.xlsx) file. You can specify the sheet name for the output.
Setting it up
To use the Export query to Excel function, follow these instructions:
{{popups:rpas/add:action=db-export-excel}}
Once on a process map:
- Navigate to the process where you would like to add the Export query to Excel 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 Excel 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 Excel file will be written (must end in .xlsx) |
| Params | No | Array | - | An array of values for parameterised queries |
| Sheet name | No | Text | Sheet1 | The name of the worksheet in the Excel file |
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 meaningful sheet names to make the exported file easier to navigate
- The file path must end in .xlsx for proper Excel format
- Use SELECT with specific column names and aliases for readable headers