readCSV: cannot get() first element by name

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Trying to access the first element by name via get method always fails:

      Mapping for a not found, expected one of [a, b, c, d]

       

      --Example--

      CSVFormat fmt = CSVFormat.EXCEL.withHeader().withDelimiter(';' as char)
      def data = readCSV file: 'test.csv' , format: fmt
      echo records[0].get('d')
      echo records[0].get('c')
      echo records[0].get('b')
      echo records[0].get('a')

      --Output--

      3

      2

      1

      Mapping for a not found, expected one of [a, b, c, d]

      --'test.csv' contents---

      a;b;c;d
      test;1;2;3

            Assignee:
            rsandell
            Reporter:
            Klaus Hegemann
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: