Google Apps Script function to create a Google Document or a Google Spreadsheet based on a pre-existing template