Hello!
If you want to keep the formatting unchanged, consider using an actxserver (see here) onto Excel. Then you can access all the functions of Microsoft to modify your file.
To have the complete list of available functions accessible: Microsoft documentation. A good solution for you would be to open your template, save it under the new name and then modify it (all the steps are in the demo).
Best !