DataDrivenFramework/src/main/java/com/datadriven/framework/utils/ReadExcelDataFile.java
public boolean addColumn(String sheetName, String colName) {
		try {
			fis = new FileInputStream(path);
			workbook = new XSSFWorkbook(fis);
			int index = workbook.getSheetIndex(sheetName);
			if (index == -1)
				return false;

			XSSFCellStyle style = workbook.createCellStyle();
			style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);

			sheet = workbook.getSheetAt(index);

			row = sheet.getRow(0);
			if (row == null)
				row = sheet.createRow(0);

			if (row.getLastCellNum() == -1)
				cell = row.createCell(0);
			else
				cell = row.createCell(row.getLastCellNum());

			cell.setCellValue(colName);
			cell.setCellStyle(style);

			fileOut = new FileOutputStream(path);
			workbook.write(fileOut);
			fileOut.close();

		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}

		return true;

	}
/****************** Returns true if column is created successfully ***********************/
Returns true if column is created successfully
Returns true if column is created successfully
public boolean addColumn(String sheetName, String colName) {
		try {
			fis = new FileInputStream(path);
			workbook = new XSSFWorkbook(fis);
			int index = workbook.getSheetIndex(sheetName);
			if (index == -1)
				return false;
			XSSFCellStyle style = workbook.createCellStyle();
			style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
			sheet = workbook.getSheetAt(index);
			row = sheet.getRow(0);
			if (row == null)
				row = sheet.createRow(0);
			if (row.getLastCellNum() == -1)
				cell = row.createCell(0);
			else
				cell = row.createCell(row.getLastCellNum());
			cell.setCellValue(colName);
			cell.setCellStyle(style);
			fileOut = new FileOutputStream(path);
			workbook.write(fileOut);
			fileOut.close();
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}
public boolean addColumn ( String sheetName , String colName ) { try { fis = new FileInputStream ( path ) ; workbook = new XSSFWorkbook ( fis ) ; int index = workbook . getSheetIndex ( sheetName ) ; if ( index == - 1 ) return false ; XSSFCellStyle style = workbook . createCellStyle ( ) ; style . setFillForegroundColor ( HSSFColor . GREY_40_PERCENT . index ) ; sheet = workbook . getSheetAt ( index ) ; row = sheet . getRow ( 0 ) ; if ( row == null ) row = sheet . createRow ( 0 ) ; if ( row . getLastCellNum ( ) == - 1 ) cell = row . createCell ( 0 ) ; else cell = row . createCell ( row . getLastCellNum ( ) ) ; cell . setCellValue ( colName ) ; cell . setCellStyle ( style ) ; fileOut = new FileOutputStream ( path ) ; workbook . write ( fileOut ) ; fileOut . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return false ; } return true ; }
Returns true if column is created successfully
Returns true if column is created successfully