Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have 2 excel files A and B with file A is file which contain template sheet(tmpSheet).And now I want to before read data to file B, I will copy tmpsheet from file A to file B and rename to ListStudent with all format data of tmpsheet, Then I read data to sheet ListStudent.

This is my requirement, but I don't know how to coding for this.

I hope that I will receive your help.

Thank in advance.
Posted
Comments
Gooppoiner 12-Apr-19 5:28am    
Here is a straightforward solution that you can try out:

ExcelFile workbookA = ExcelFile.load("A.xlsx");
ExcelFile workbookB = ExcelFile.load("B.xlsx");

ExcelWorksheet templateSheet = workbookA.getWorksheet("tmpSheet");
workbookB.getWorksheets().addCopy("ListStudent", templateSheet);

workbookB.save("B.xlsx");

This API is from this excel library for Java.

1 solution

 
Share this answer
 
Comments
ngthtra 10-Mar-13 5:49am    
I don't found nay solution from this link, please help me
Richard MacCutchan 10-Mar-13 8:52am    
Have you checked all the links? The one titled Java Excel API Tutorial includes a section on copying spreadsheets. All you have to do is modify that code to your own specifications.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900