public void WriteExcel(String FilePath,String SheetName,int row,int col,String data) throws IOException,FileNotFoundException
{
FileInputStream fsIP= new FileInputStream(new File(FilePath)); //Read the spreadsheet that needs to be updated
XSSFWorkbook wb = new XSSFWorkbook(fsIP); //Access the workbook
XSSFSheet worksheet = wb.getSheet(SheetName); //Access the worksheet, so that we can update / modify it.
// int rowcount=worksheet.getLastRowNum();//return row count
// HSSFRow row1 = worksheet.createRow(row);
XSSFRow row1 = worksheet.getRow(row);
XSSFCell cell = row1.createCell((short) col); //Create a new cell in current row
cell.setCellValue(data); //Set value to new value
fsIP.close(); //Close the InputStream
FileOutputStream output_file =new FileOutputStream(new File(FilePath)); //Open FileOutputStream to write updates
wb.write(output_file); //write changes
output_file.close(); //close the stream
}
Best place to learn Appium Android IOS Automation Testing Training in Chennai
ReplyDeleteGo for Appium training in chennai for real time mobile automation testing training with real time project support.
UI Automation Tools with real time scenarios You can contact 8122241286 for Best APPIUM and selenium Training in Chennai