Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package poisample2; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * * @author andad */ public class POIsample2 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here try { XSSFWorkbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet(); Row row = sheet.createRow(0); Cell cell = row.createCell(0); cell.setCellValue("Hi there"); OutputStream out; out = new FileOutputStream(new File("testout.xlsx")); wb.write(out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } }