if (dataContext == null) {
File file = new File(filename);
dataContext = new ExcelDataContext(file);
Table table = getTable(dataContext, sheetName, columns);
dataContexts.put(filename, dataContext);
counters.put(filename, new AtomicInteger(1));
outputWriter = new ExcelOutputWriter(dataContext, filename, table, columns);
// write the headers
} else {
Table table = getTable(dataContext, sheetName, columns);
outputWriter = new ExcelOutputWriter(dataContext, filename, table, columns);
counters.get(filename).incrementAndGet();
}
}