UPDATE COLUMN NAME AT RUN TIME OF EXCEL







UserName1 Password1 Password1 Password1


package com.readExcelFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ReadExcelFile {

public static void main(String[] args) throws Exception {

FileInputStream fsIP = new FileInputStream(
new File("E:\\EclipseWorkSpace_8thApril\\ReadExcelFile\\TestData.xlsx"));
XSSFWorkbook wb = new XSSFWorkbook(fsIP);
XSSFSheet worksheet = wb.getSheetAt(0);
Cell cell = null;
cell = worksheet.getRow(0).getCell(2);
cell.setCellValue("OverRide");
fsIP.close();
FileOutputStream output_file = new FileOutputStream(
new File("E:\\EclipseWorkSpace_8thApril\\ReadExcelFile\\TestData2.xlsx"));
wb.write(output_file);
output_file.close();
}

}



Output:

UserName1Password1  OverRide            Password1

No comments:

About Me

My photo
Pune, Maharastra, India
You can reach me out at : jimmiamrit@gmail.com