|
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:
|
No comments:
Post a Comment