<dependency>
<groupId> e-iceblue </groupId>
<artifactId>spire.xls</artifactId>
<version>12.7.0</version>
</dependency>
List<String> allFile1 = POIUtils2.getAllFile(new File(tempDir));
assert allFile1 != null;
for (String file1 : allFile1) {
tempBook.loadFromFile(file1);
for (Object sheet : tempBook.getWorksheets()) {
Worksheet sheet1= (Worksheet) sheet;
newBook.getWorksheets().addCopy(sheet1, WorksheetCopyType.CopyAll);
}
}
newBook.saveToFile(targetPath, ExcelVersion.Version2016);