Creating a header and footer for a worksheet

In this post under Apache excel, I will show with example how to add header and footer to an Worksheet. Below is the complete code for your reference. Main Class 1 package package5; 2 3 import java.io.BufferedReader; 4 import java.io.File; 5 import java.io.FileOutputStream; 6 import java.io.FileReader; 7 import java.io.IOException; 8 9 import org.apache.poi.xssf.usermodel.XSSFCell; 10 import…… Continue reading Creating a header and footer for a worksheet

Writing to a worksheet

In this post under Apache Excel, I will with example how to write to a worksheet. For our example, we will use a text file “Input1.txt” to read the data to be written to worksheet. The “Input1.txt” file contains comma separated values as shown below Line1Column1,Line1Column2,Line1Column3,Line1Column4 Line2Column1,Line2Column2,Line2Column3,Line2Column4 Line3Column1,Line3Column2,Line3Column3,Line3Column4 Line4Column1,Line4Column2,Line4Column3,Line4Column4 Below is the complete code for…… Continue reading Writing to a worksheet

Cloning a sheet in a Worksheet

In this post under Apache Excel, I will show how to clone an existing sheet in a Worksheet. Below is the complete code for your reference. Main class 1 package package3; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileOutputStream; 6 import java.io.IOException; 7 8 import org.apache.poi.openxml4j.exceptions.InvalidFormatException; 9 import org.apache.poi.ss.usermodel.Sheet; 10 import org.apache.poi.xssf.usermodel.XSSFSheet; 11…… Continue reading Cloning a sheet in a Worksheet

Reading an excel worksheet

In this post under Apache Excel, I will show with example how to read an excel (*.xlsx) document. Below is the complete code for your reference. Main Class 1 package package2; 2 3 import java.io.File; 4 import java.io.IOException; 5 6 import org.apache.poi.openxml4j.exceptions.InvalidFormatException; 7 import org.apache.poi.xssf.usermodel.XSSFCell; 8 import org.apache.poi.xssf.usermodel.XSSFRow; 9 import org.apache.poi.xssf.usermodel.XSSFSheet; 10 import org.apache.poi.xssf.usermodel.XSSFWorkbook; 11…… Continue reading Reading an excel worksheet

Creating a blank worksheet

In this post under Apache Excel, I will show with example how to create a blank excel document. Below is the code for your reference. Main class 1 package package1; 2 3 import java.io.File; 4 import java.io.FileOutputStream; 5 import java.io.IOException; 6 7 import org.apache.poi.xssf.usermodel.XSSFWorkbook; 8 9 public class Example1 { 10 public static void main(String[]…… Continue reading Creating a blank worksheet