Skip to content

CSV Actions

CSV Actions to interact with CSV files

Actions

csv.open

Open an given CSV file to start interacting with other CSV Actions

Parameters:

filepath - Path to CSV file

encoding (optional) - File encoding (default='UTF-8')

Return:

csv - CSV file instance to be used for future interactions

csv.get_lines

Return all lines of the CSV file

Parameters:

csv_file - CSV instance given from csv.open

delimiter (optional) - Define CSV delimiter (default=',')

first_line_header (optional) - Treats the first CSV line as a header, returning it in a different variable than the remaining lines (default=True)

Returns:

lines - A list of lists with all lines in file

headers - List with first CSV line removed from lines (if first_line_header=True)

csv.close

Closes the file

Parameters:

csv_file - CSV instance given from csv.open

Returns:

This action gives no return