title: Appending to CSV file without headers
body: <p>I am using <a href="http://opencsv.sourceforge.net/" rel="noreferrer">opencsv</a> to write a Java bean to a CSV file with headers. The file name contains the current date. If the user runs it for a second time in the same day, it appends to the file but adds another header line.</p>
  
  <p>How do I append to the file but without the column headers.</p>
  
  <pre><code>    public class CSVExport {
  
  final File USERHOME = new File(System.getProperty("user.home"));
  final List&lt;saleExport&gt; listSaleExport = new ArrayList&lt;&gt;();
  final ObjectMapper mapper = new ObjectMapper();
  
  public void createCsvFile(String Region, Map&lt;String, String&gt; currentSale) throws IOException {
  
      mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
      // use column position mapping strategy for no headers?
      LocalDate today = LocalDate.now();
  
                  final SaleExport saleExport = mapper.convertValue(currentSale, SaleExport.class);
                  listSaleExport.add(saleExport);
                  writeToFile(today +" LA.csv", listSaleExport);
  }
  
  public void writeToFile(String filename, List&lt;listSaleExport&gt; listSaleExport) throws IOException {
  
      File file = new File(PROCESSED_DIR +"\\", "filename");
  
      if (!file.exists()) {
          try {
              Writer writer = new FileWriter(PROCESSED_DIR +"\\" +filename, true);
              StatefulBeanToCsvBuilder&lt;listSaleExport&gt; beanToCsv = new StatefulBeanToCsvBuilder&lt;&gt;(writer);
              StatefulBeanToCsv&lt;listSaleExport&gt; beanWriter = beanToCsv.build();
              beanWriter.write(listSaleExport);
              writer.close();
          } catch (Exception ex) {
              System.out.println("Error : " + ex.getMessage());
          }
      } else {
          try {
              Writer writer = new FileWriter(PROCESSED_DIR +"\\" +"filename");
              StatefulBeanToCsvBuilder&lt;listSaleExport&gt; beanToCsv = new StatefulBeanToCsvBuilder&lt;&gt;(writer);
              StatefulBeanToCsv&lt;listSaleExport&gt; beanWriter = beanToCsv.build();
              beanWriter.write(listSaleExport);
              writer.close();
          } catch (Exception ex) {
              System.out.println("Error : " + ex.getMessage());
          }
      }
    }
  }
  </code></pre>