Export data to XLSM file in PHP and ASP classic The first step is to create an XLSM or XLTM file in Microsoft Excel that has the macro code defined. The Excel file can be empty or already filled with sheets and some data like report header. This will be the Excel template file that will be loaded using ExcelDocument.