This article shows how to copy a worksheet from an Excel document to anther by using Spire.XLS for Java.
import com.spire.xls.Workbook; import com.spire.xls.Worksheet; public class CopySheetBetweenWorkbooks { public static void main(String[] args) { //Create a Workbook object to load the source document Workbook srcWorkbook = new Workbook(); srcWorkbook.loadFromFile("C:\\Users\\Administrator\\Desktop\\source.xlsx"); //Get the specific worksheet to copy Worksheet originalSheet = srcWorkbook.getWorksheets().get(0); //Create another Workbook object to load the destination document Workbook destWorkbook = new Workbook(); destWorkbook.loadFromFile("C:\\Users\\Administrator\\Desktop\\destination.xlsx"); //Add the copy of selected sheet to destination document Worksheet newSheet = destWorkbook.getWorksheets().addCopy(originalSheet); newSheet.setName(originalSheet.getName()); //Copy the theme of source document to destination document destWorkbook.copyTheme(srcWorkbook); //Save to another file destWorkbook.saveToFile("CopySheetBetweenWorkbooks.xlsx"); } }