1

I am quite new to Univocity Parser and I want to know if there is any way I can parse the csv file based on a value of particular column, considering the size of CSV I want to parse it based on a date attribute.(For Ex: if date is 1/1/2020 then parse only those rows that has date value matches with given value, i.e., 1/1/2020)

I will really appreciate if you can provide me any insight regarding this.

I really appreciate if someone can provide me any insight with the stated problem.

Thankyou, Ria

Ria Sachdeva
  • 113
  • 6

2 Answers2

0
parser.beginParsing(new FileReader(new File("abc.csv")));
        int count=0;
        String[] row;
        List<AttributesField> beanss= new ArrayList<>();
        while((row=parser.parseNext())!= null)
        {
            AttributesField af=rowProcessor.createBean(row, parser.getContext());
            row=af.getCommitted_at().split(" ");
            if(row[0].compareTo("2013-11-13") <=0)  //Hardcode the date: return a.compareTo(d) * d.compareTo(b) > 0;
            {
                beanss.add(af);
            }
        }
Ria Sachdeva
  • 113
  • 6
0

Just filter and skip rows you don't need. This is very easy since univocity provides iterative approach.

art
  • 174
  • 1
  • 9