DATABASE Import CSV to table function

Read a CSV file and bulk-insert its contents into a database table.

Help CentreBuilding 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:

  1. Navigate to the process where you would like to add the Import CSV to table function
  2. Click on the green button's drop-down (right side of the green button labelled "Process")
  3. On the menu that appears, click on the "+ Activity" item
  4. From here you can select the Import CSV to table option
  5. Click "Add" once you are done

Input parameters

ParameterRequiredTypeDefaultDescription
NameYesText-The alias of a previously opened connection (from db-connect)
TableYesText-The target table name
PathYesText-The file path to the CSV file
DelimiterNoText,The column delimiter character
Has headerNoBooleantrueWhether the first row contains column headers
Batch sizeNoNumber1000The number of rows to insert per batch
VariableNoTextimported_rowsVariable name to store the total number of imported rows

Output variables

VariableTypeDescription
{imported_rows}IntegerThe total number of rows successfully imported

Errors

ErrorDescription
File not foundThe specified CSV file does not exist at the given path
Table not foundThe specified table does not exist in the database
Column mismatchThe 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

Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.