Forum Discussion

aparna_11's avatar
aparna_11
New Contributor
3 years ago
Solved

how to read csv file having delimiters as separators using groovy script

Can anyone share sample code how to read CSV file having delimiter as separator and what all jars required

  • Hi aparna_11 

     

    May be you could find some useful informations here:

    https://www.baeldung.com/groovy-file-read

     

    For example by reading your file line by line, and then split each line with the separator you use into your CSV file.

    It will provide you a list of items for your line.

    To go further, you can also declare a specific class for stocking your values and use a list to populate all of your data.

     

    Hope this helps.

     

     

    David.

3 Replies

  • ZDGN's avatar
    ZDGN
    Contributor

    Hi aparna_11 

     

    May be you could find some useful informations here:

    https://www.baeldung.com/groovy-file-read

     

    For example by reading your file line by line, and then split each line with the separator you use into your CSV file.

    It will provide you a list of items for your line.

    To go further, you can also declare a specific class for stocking your values and use a list to populate all of your data.

     

    Hope this helps.

     

     

    David.

    • aparna_11's avatar
      aparna_11
      New Contributor

      ZDGN  David

      Thank you for your support i could able to read data from CSV file. The link you provided is helpful

       

      Thank you again

      Aparna

      • richie's avatar
        richie
        Community Hero
        ZDGN,

        That link you provided is great!

        Really helpful. Kudos definitely earned on that one fella!

        Nice one

        Rich