Skip to content

Instantly share code, notes, and snippets.

View tangtao-xp1's full-sized avatar
🤪
Coding makes me happy!

tangtao-xp1

🤪
Coding makes me happy!
View GitHub Profile
@davidsommer
davidsommer / mergeExcel.java
Created December 5, 2013 14:01
Merge a List of Excel Files with POI Copies all Sheets, Fields of a List of Excel Files into a new one
public static void mergeExcelFiles(File file, List<FileInputStream> list) throws IOException {
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet(file.getName());
for (FileInputStream fin : list) {
HSSFWorkbook b = new HSSFWorkbook(fin);
for (int i = 0; i < b.getNumberOfSheets(); i++) {
copySheets(book, sheet, b.getSheetAt(i));
}
}