Blog Archives

Read Excel file in Java using POI API


import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Iterator; public class ReadExcelFileUsingPOI{     public static void main(String[] args) throws Exception {         String filename = “D:\\test.xls”;         FileInputStream fis = null;         try {             fis = new FileInputStream(filename);             HSSFWorkbook workbook = new HSSFWorkbook(fis);             HSSFSheet sheet = workbook.getSheetAt(0);             Iterator rows = sheet.rowIterator();             while (rows.hasNext()) {                 HSSFRow row = (HSSFRow) rows.next();                 Iterator cells

Tagged with: , , , , ,
Posted in JAVA, POI API

How to Create Excel file in Java using POI API


import java.io.FileOutputStream; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class CreateExcelFile { public static final String FILE_NAME = “D:\\test.xls”; public void createExcelFile(String filename) { try { HSSFWorkbook hwb = new HSSFWorkbook(); HSSFSheet sheet = hwb.createSheet(“Sheet1”);   HSSFRow rowhead = sheet.createRow((short)

Tagged with: , , , , ,
Posted in POI API

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 677 other followers

Calendar
July 2019
M T W T F S S
« Jan    
1234567
891011121314
15161718192021
22232425262728
293031  
Mallikarjun Gunda

This is Mallikarjun Gunda, I am working as a software professional. Blogging is my Passion. This blog contains the posts on Java related technologies and programming languages. I am happy to share my knowledge through the blogs.

Blog Stats
  • 311,890 hits
IndiBlogger
malliktalksjava.wordpress.c...
70/100