csv:merge

Merges columns from a secondary CSV file into a primary CSV file

Options

NameTypeDescription
input_filestringPath to the primary CSV file
input_separatorstringField separator for the primary input file
merge_filestringPath to the secondary CSV file whose columns are merged in
merge_separatorstringField separator for the merge file
output_filestringPath for the merged output CSV file
output_separatorstringField separator for the output file
headerboolWhen true, headers are read from and written to all files
columns[]stringSpecific columns from the merge file to include; defaults to all columns

Outputs

NameTypeDescription
output_filestringPath of the merged output file
records_mergedintNumber of data rows in the merged output

Example

name: Merge two CSV files
actions:
  - name: merged
    component: csv:merge
    vars:
      input_file: base.csv
      merge_file: extra.csv
      output_file: combined.csv
      header: true

outputs:
  file: "{{ merged.output_file }}"
  merged: "{{ merged.records_merged }}"