I am trying to figure out how to align text in the middle vertically. According to the documentation I have found my following example should work:
var form = FormApp.getActiveForm();
var ss = SpreadsheetApp.openById(form.getDestinationId());
var sheet = ss.getSheets()[0];
var fullRange = sheet.getRange("A1:Z1001");
fullRange.setHorizontalAlignment(DocumentApp.HorizontalAlignment.CENTER);
fullRange.setVerticalAlignment(DocumentApp.VerticalAlignment.CENTER);
The interesting thing I find is that the Horizontal Alignment works, but the vertical one does not. Am I possibly using out dated methods? Is there a better way to accomplish this?
Just use
middle
as the parameter for setVerticalAlignment() :You're using the Enum for the DocumentApp intended for Google Docs tables and cells and you're using Spreadsheets.