Read CSV File
Allows you to import data from a CSV file to load into a database.
The Read CSV file block takes any CSV-compatible file as a source and reads it line by line. Has an Each row stream output connector that directs the flow of commands after each row is read. Use the "Row Columns" output variable to get an array of columns for further processing.
The Read CSV file is similar in functionality to the For each loop block: they both iterate over the array elements, but the Read CSV file reads lines. When all lines have been read, the command stream will be sent to the Completed stream connector.
The blocks for processing Excel files operate on a similar principle: Read XLSX file and Read XLS file.
Tip: combine this block with a For Each block to iterate over each column in a row, and then use a Switch block to process columns values based on the column number or column name (see video above for more).
Flow Connections
- [Input] In - starts the block's execution.
- [Output] Each row - activates once for each row in the file.
- [Output] Completed - activates when all the rows in the file have been iterated over.
Data Connections
- [Input] CSV file (file) - CSV file to be read.
- [Output] Row number (integer) - number of the row currently being read (starting at 1), increases by 1 with every iteration.
- [Output] Row columns (string array) - contents of the columns of the row currently being read in string format.