DataDrivenFramework/src/main/java/com/datadriven/framework/utils/ReadExcelDataFile.java
public boolean removeColumn(String sheetName, int colNum) {
		try {
			if (!isSheetExist(sheetName))
				return false;
			fis = new FileInputStream(path);
			workbook = new XSSFWorkbook(fis);
			sheet = workbook.getSheet(sheetName);
			XSSFCellStyle style = workbook.createCellStyle();
			style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
			XSSFCreationHelper createHelper = workbook.getCreationHelper();
			

			for (int i = 0; i < getRowCount(sheetName); i++) {
				row = sheet.getRow(i);
				if (row != null) {
					cell = row.getCell(colNum);
					if (cell != null) {
						cell.setCellStyle(style);
						row.removeCell(cell);
					}
				}
			}
			fileOut = new FileOutputStream(path);
			workbook.write(fileOut);
			fileOut.close();
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;

	}
/****************** Removes a column and all the contents ***********************/
Removes a column and all the contents
Removes a column and all the contents
public boolean removeColumn(String sheetName, int colNum) {
		try {
			if (!isSheetExist(sheetName))
				return false;
			fis = new FileInputStream(path);
			workbook = new XSSFWorkbook(fis);
			sheet = workbook.getSheet(sheetName);
			XSSFCellStyle style = workbook.createCellStyle();
			style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
			XSSFCreationHelper createHelper = workbook.getCreationHelper();
			for (int i = 0; i < getRowCount(sheetName); i++) {
				row = sheet.getRow(i);
				if (row != null) {
					cell = row.getCell(colNum);
					if (cell != null) {
						cell.setCellStyle(style);
						row.removeCell(cell);
					}
				}
			}
			fileOut = new FileOutputStream(path);
			workbook.write(fileOut);
			fileOut.close();
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}
public boolean removeColumn ( String sheetName , int colNum ) { try { if ( ! isSheetExist ( sheetName ) ) return false ; fis = new FileInputStream ( path ) ; workbook = new XSSFWorkbook ( fis ) ; sheet = workbook . getSheet ( sheetName ) ; XSSFCellStyle style = workbook . createCellStyle ( ) ; style . setFillForegroundColor ( HSSFColor . GREY_40_PERCENT . index ) ; XSSFCreationHelper createHelper = workbook . getCreationHelper ( ) ; for ( int i = 0 ; i < getRowCount ( sheetName ) ; i ++ ) { row = sheet . getRow ( i ) ; if ( row != null ) { cell = row . getCell ( colNum ) ; if ( cell != null ) { cell . setCellStyle ( style ) ; row . removeCell ( cell ) ; } } } fileOut = new FileOutputStream ( path ) ; workbook . write ( fileOut ) ; fileOut . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return false ; } return true ; }
Removes a column and all the contents
Removes a column and all the contents