title: drop data CSV with java
body: <p>i have a problem with CSV dowload with php. my CSV contains http headers and i need delete this information for after automatically one process update database. Also i need delete column for this CSV.</p>
  <p>i don´t kwon how i can delete my http header from CSV and i don´t know how i can delete this column.</p>
  <p>i can read my all content CSV with this code:</p>
  <pre><code>public static void main(String[] args) throws FileNotFoundException, IOException, 
  
  CsvValidationException {
      String archCSV = System.getProperty(&quot;user.dir&quot;) + &quot;\\MYLAR.csv&quot;;
      CSVReader csvReader = new CSVReader(new FileReader(archCSV));
      String[] fila = null;
      while((fila = csvReader.readNext()) != null) {
          System.out.println(fila[0]);
      }
  
      csvReader.close();
  }
  </code></pre>
  <p>and i get all my content CSV. In console i get this:</p>
  <pre><code>HTTP/1.1 200 OK
  Date: Wed
  Server: Apache/2.4.18 (Unix) OpenSSL/1.0.2g PHP/5.6.19 mod_perl/2.0.8-dev Perl/v5.16.3
  Vary: Host
  X-Powered-By: PHP/5.6.19
  Pragma: public
  Last-Modified: Wed
  Cache-Control: no-store
  Cache-Control: pre-check=0
  Cache-Control: private
  Content-Transfer-Encoding: none
  Content-Disposition: attachment; filename=&quot;tarifa_general.csv
  Content-Length: 1682234
  Set-Cookie:
  Content-Type: text/csv; charset=utf-8
  
  CATEGORY_PATH;MANUFACTURER;ID_PRODUCT;PRODUCT;REFERENCE;REFERENCE_PARENT;STOCK;EAN13;SHORT_DESCRIPTION;PRICE_CUSTOMER
  PERIFÉRICOS &gt; IMPRESORAS / FAX &gt; IMPRESORAS &gt; EPSON &gt; MATRICIALES&quot;;EPSON;1;&quot;IMPRESORA EPSON LQ-2190&quot;;C11CA92001;;0;8715946459172;000003;910.33
  </code></pre>
  <p>how will i can delete http header and my columns that i wan´t ?</p>
  <p>thanks for help</p>
  <p><strong>EDIT with ; delimiter</strong></p>
  <pre><code>public static void main(String[] args) throws FileNotFoundException, IOException, CsvValidationException, CsvException {
      Path archCSV = Paths.get(System.getProperty(&quot;user.dir&quot;), &quot;MYLAR.csv&quot;);
      
      try (BufferedReader fileReader = Files.newBufferedReader(archCSV)) {
  
      // Skip HTTP Headers
      for (String line; (line = fileReader.readLine()) != null; )
          if (line.isEmpty())
              break; // Found end of HTTP Headers
      }
  
      CSVParser parser = new CSVParserBuilder().withSeparator(';').build();
      try (BufferedReader br = Files.newBufferedReader(archCSV,  StandardCharsets.UTF_8);
                                
          CSVReader reader = new CSVReaderBuilder(br).withCSVParser(parser).build()) {
         
              List&lt;String[]&gt; rows = reader.readAll();
  
              for (String[] row : rows) {
                  for (String e : row) {
                      System.out.format(&quot;%s &quot;, e);
                  }
                  System.out.println();
              }
          }
  }
  </code></pre>
  <p><strong>output</strong></p>
  <pre><code>HTTP/1.1 200 OK 
  Date: Wed, 04 Nov 2020 10:33:57 GMT 
  Server: Apache/2.4.18 (Unix) OpenSSL/1.0.2g PHP/5.6.19 mod_perl/2.0.8-dev Perl/v5.16.3 
  Vary: Host 
  X-Powered-By: PHP/5.6.19 
  Pragma: public 
  Last-Modified: Wed, 04 Nov 2020 10:35:38 GMT 
  Cache-Control: no-store, no-cache, must-revalidate 
  Cache-Control: pre-check=0, post-check=0, max-age=0 
  Cache-Control: private 
  Content-Transfer-Encoding: none 
  Content-Disposition: attachment  filename=&quot;tarifa_general.csv 
  Content-Length: 1682234 
  Set-Cookie
  expires=Tue, 24-Nov-2020 10:33:57 GMT  Max-Age=1727899  path=/  domain=www.mylar.es  httponly 
  Content-Type: text/csv  charset=utf-8 
   
  CATEGORY_PATH MANUFACTURER ID_PRODUCT PRODUCT REFERENCE REFERENCE_PARENT STOCK EAN13 SHORT_DESCRIPTION PRICE_CUSTOMER 
  PERIFÉRICOS &gt; IMPRESORAS / FAX &gt; IMPRESORAS &gt; EPSON &gt; MATRICIALES EPSON 1 IMPRESORA EPSON LQ-2190 C11CA92001  0 8715946459172 000003 910.33 
  </code></pre>
  <p><strong>SOLUTION</strong></p>
  <pre><code>public static void main(String[] args) throws FileNotFoundException, IOException, CsvValidationException, CsvException {
      Path archCSV = Paths.get(System.getProperty(&quot;user.dir&quot;), &quot;MYLAR.csv&quot;);
      
  
      CSVParser parser = new CSVParserBuilder().withSeparator(';').build();
      try (BufferedReader br = Files.newBufferedReader(archCSV,  StandardCharsets.UTF_8);
                                
          CSVReader reader = new CSVReaderBuilder(br).withCSVParser(parser).build()) {
          
          // Skip HTTP Headers
          for (String line; (line = br.readLine()) != null; )
              if (line.isEmpty())
                  break; // Found end of HTTP Headers
         
              List&lt;String[]&gt; rows = reader.readAll();
  
              for (String[] row : rows) {
                  for (String e : row) {
                      //System.out.format(&quot;%s &quot;, e);
                      System.out.println(row[2]);
                  }
                  System.out.println();
              }
          }
  }
  </code></pre>