Help Centre › Building Processes
This article describes the RPA Database functionality to import a CSV file into a database table.
For a full list of available functions, please read DATABASE functions.
Description
The Import CSV to table function reads a CSV file and bulk-inserts its contents into a database table. It supports custom delimiters and can handle files with or without header rows.
Setting it up
To use the Import CSV to table function, follow these instructions:
{{popups:rpas/add:action=db-import-csv}}
Once on a process map:
- Navigate to the process where you would like to add the Import CSV to table 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 Import CSV to table 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) |
| Table | Yes | Text | - | The target table name |
| Path | Yes | Text | - | The file path to the CSV file |
| Delimiter | No | Text | , | The column delimiter character |
| Has header | No | Boolean | true | Whether the first row contains column headers |
| Batch size | No | Number | 1000 | The number of rows to insert per batch |
| Variable | No | Text | imported_rows | Variable name to store the total number of imported rows |
Output variables
| Variable | Type | Description |
|---|---|---|
| {imported_rows} | Integer | The total number of rows successfully imported |
Errors
| Error | Description |
|---|---|
| File not found | The specified CSV file does not exist at the given path |
| Table not found | The specified table does not exist in the database |
| Column mismatch | The CSV columns do not match the table columns |
Tips
- Ensure CSV column names match the database table column names exactly
- Use has_header=false for headerless CSV files – columns will be mapped by position
- Use a semicolon delimiter for European-format CSV files