github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/inputs/csv.md (about)

     1  ---
     2  title: csv
     3  type: input
     4  status: stable
     5  categories: ["Local"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/input/csv.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  Reads one or more CSV files as structured records following the format described in RFC 4180.
    19  
    20  
    21  <Tabs defaultValue="common" values={[
    22    { label: 'Common', value: 'common', },
    23    { label: 'Advanced', value: 'advanced', },
    24  ]}>
    25  
    26  <TabItem value="common">
    27  
    28  ```yaml
    29  # Common config fields, showing default values
    30  input:
    31    label: ""
    32    csv:
    33      paths: []
    34      parse_header_row: true
    35      delimiter: ','
    36  ```
    37  
    38  </TabItem>
    39  <TabItem value="advanced">
    40  
    41  ```yaml
    42  # All config fields, showing default values
    43  input:
    44    label: ""
    45    csv:
    46      paths: []
    47      parse_header_row: true
    48      delimiter: ','
    49      batch_count: 1
    50  ```
    51  
    52  </TabItem>
    53  </Tabs>
    54  
    55  This input offers more control over CSV parsing than the [`file` input](/docs/components/inputs/file).
    56  
    57  When parsing with a header row each line of the file will be consumed as a structured object, where the key names are determined from the header now. For example, the following CSV file:
    58  
    59  ```csv
    60  foo,bar,baz
    61  first foo,first bar,first baz
    62  second foo,second bar,second baz
    63  ```
    64  
    65  Would produce the following messages:
    66  
    67  ```json
    68  {"foo":"first foo","bar":"first bar","baz":"first baz"}
    69  {"foo":"second foo","bar":"second bar","baz":"second baz"}
    70  ```
    71  
    72  If, however, the field `parse_header_row` is set to `false` then arrays are produced instead, like follows:
    73  
    74  ```json
    75  ["first foo","first bar","first baz"]
    76  ["second foo","second bar","second baz"]
    77  ```
    78  
    79  ## Fields
    80  
    81  ### `paths`
    82  
    83  A list of file paths to read from. Each file will be read sequentially until the list is exhausted, at which point the input will close. Glob patterns are supported, including super globs (double star).
    84  
    85  
    86  Type: `array`  
    87  Default: `[]`  
    88  
    89  ```yaml
    90  # Examples
    91  
    92  paths:
    93    - /tmp/foo.csv
    94    - /tmp/bar/*.csv
    95    - /tmp/data/**/*.csv
    96  ```
    97  
    98  ### `parse_header_row`
    99  
   100  Whether to reference the first row as a header row. If set to true the output structure for messages will be an object where field keys are determined by the header row.
   101  
   102  
   103  Type: `bool`  
   104  Default: `true`  
   105  
   106  ### `delimiter`
   107  
   108  The delimiter to use for splitting values in each record, must be a single character.
   109  
   110  
   111  Type: `string`  
   112  Default: `","`  
   113  
   114  ### `batch_count`
   115  
   116  Optionally process records in batches. This can help to speed up the consumption of exceptionally large CSV files. When the end of the file is reached the remaining records are processed as a (potentially smaller) batch.
   117  
   118  
   119  Type: `int`  
   120  Default: `1`  
   121  
   122  This input is particularly useful when consuming CSV from files too large to
   123  parse entirely within memory. However, in cases where CSV is consumed from other
   124  input types it's also possible to parse them using the
   125  [Bloblang `parse_csv` method](/docs/guides/bloblang/methods#parse_csv).
   126