There is the Garbage Collection. More performance hints:
Not sure if it is better but you can use OpenPyxl to append data to an existing excel sheet.
And I assume it is necessary to write to a template to preserve the formats? Or would it be possible to write to a blank sheet and add the formats later?