The SuiteScript API will not even allow you to create an excel file natively (xls), only CSV.
You will need something like SheetJS and even that does not give you the ability to create excel with macros.
SheetJS will be able to read an excel containing macros and save it while preserving those macros, but it does not create excel files and add macros to it.