If you need to copy the data from one Excel file into another Excel using test automation, we can use Apache POI open-source library to do that.
Here’s the self-explanatory code but do let me know if you have any queries. For other details, you can go through https://www.javatpoint.com/apache-poi-tutorial
Code Repo link: https://github.com/dgambhir01/utilities/blob/master/src/test/java/Util/util_helper/CopyExcel.java