@Override
    public void addRow(IRow row) {

        Sheet sheet = wb.getSheet(row.getSheetName());
        if (sheet == null) {
            sheet = wb.createSheet(row.getSheetName());
        }

        final int lastRow = sheet.getLastRowNum();
        Row r = sheet.getRow(lastRow);
        if (r == null) {
            //we're here if this is the first row in the sheet
            r = sheet.createRow(lastRow);
        } else {
            //we're here if the row already existed, create the next one
            r = sheet.createRow(lastRow + 1);
        }

        if (logger.isLoggable(Level.FINEST)) {
            logger.log(Level.FINEST, "Adding row {0} to sheet {1}",
                    new Object[]{r.getRowNum(), sheet.getSheetName()});
        }

        for (ICell cell : row) {
            Cell c = r.createCell(cell.getColumnNum());
            c.setCellValue(cell.getValue());
        }
    }